Confusing treatment of "head" in worktree on case-insensitive FS

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

 



Hello,

When I run `git rev-parse head` inside a worktree on a case insensitive filesystem,
the result is different from `git rev-parse HEAD`.

Steps to reproduce, on a case insensitive filesystem:

$ git init
$ git commit --allow-empty -m'test'
$ git worktree add /tmp/myworktree
$ cd /tmp/myworktree
$ git commit --allow-empty -m'test'
$ git rev-parse head
adf59ca8da0ee5c4eb455f87efecc6c79eaf030f
$ git rev-parse hEAd
adf59ca8da0ee5c4eb455f87efecc6c79eaf030f
$ git rev-parse HEAD
fbb28196d08d74aa61f65e5cee3cb11cc24c338a

This also happens when using any other command involving "head", like
`git show head`, `git diff head`, etc.

What did you expect to happen?

If `git rev-parse head` returns anything at all (of course on a case-sensitive
filesystem it just returns an error), I'd expect it to be the same as `git rev-parse HEAD`.

I accidentally got into the happen of using `git diff head` instead of `git
diff HEAD` on a case insensitive filesystem and was thrown off by this
when I ran into it.

What happened instead?

When in a worktree, `head` appears to get resolved to the value of `HEAD`
in `git rev-parse --git-common-dir`, while `HEAD` gets resolved to the
value of `HEAD` in the worktree.

[System Info]
git version:
git version 2.39.2 (Apple Git-143)
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 arm64
compiler info: clang: 14.0.3 (clang-1403.0.22.14.1)
libc info: no libc information available
$SHELL (typically, interactive shell): /usr/bin/fish






[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