Bug: Git sees branch as valid commit ref and works; should fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

$ git clone https://github.com/GEOS-ESM/GFDL_atmos_cubed_sphere.git fvdycore
$ cd fvdycore
$ git checkout bugfix/mathomp4/trivial-ci-commit-gcc14

What did you expect to happen? (Expected behavior)

I expected a failure as there is no branch named
'bugfix/mathomp4/trivial-ci-commit-gcc14' in the repository.

What happened instead? (Actual behavior)

$ git checkout bugfix/mathomp4/trivial-ci-commit-gcc14
Note: switching to 'bugfix/mathomp4/trivial-ci-commit-gcc14'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at cc14d30 removed an unused module use in fv_sg

What's different between what you expected and what actually happened?

Well, git somehow saw 'bugfix/mathomp4/trivial-ci-commit-gcc14' as a
valid commit reference and checked it out. I was expecting it
to...not.

Anything else you want to add:

You can see similar behavior with git-switch, though slightly different:

$ git switch bugfix/mathomp4/trivial-ci-commit-gcc14
fatal: a branch is expected, got commit
'bugfix/mathomp4/trivial-ci-commit-gcc14'
hint: If you want to detach HEAD at the commit, try again with the
--detach option.
$ git switch --detach bugfix/mathomp4/trivial-ci-commit-gcc14
HEAD is now at cc14d30 removed an unused module use in fv_sg

So even git-switch sees 'bugfix/mathomp4/trivial-ci-commit-gcc14' as a
commit reference.

Also, I have duplicated this behavior on a SLES 15 Linux machine with
git verison 2.45.0 and on another RHEL8 box with 2.45.2

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.46.0
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
libcurl: 8.4.0
zlib: 1.2.12
uname: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul  5 17:53:24
PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T6020 arm64
compiler info: clang: 15.0.0 (clang-1500.3.9.4)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh


[Enabled Hooks]
not run from a git repository - no hooks to show

-- 
Matt Thompson
   “The fact is, this is about us identifying what we do best and
   finding more ways of doing less of it better” -- Director of Better
Anna Rampton





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux