Are GIT refs always case insensitive?

I tested on my local machine (OS-X 10.10), which uses a case-insensitive file system (HFS + [CI]) - when I reset to the head:

$ git reset head --hard $ git reset HEAD --hard 

and

 $ git checkout 4f2c $ git checkout 4F2C 

Have accurate results. As far as I understand, GIT stores links inside ./git/refs , but the case sensitivity of the underlying file system affects the results?

Am I getting the same results on a case sensitive file system?

+6
source share
2 answers

Yes, they are case insensitive. No, the case-sensitive file system does not matter. Since git refs are part of the SHA-1 hash , and these are hexadecimal digits (base-16, they just look like letters). At least for commit-id. As @EdwardThomson noted in the comments, the refname may (or may not) be case sensitive (this depends on the underlying file system and whether the storage engine is free or packed).

+6
source

No, you will not get the same results on a case sensitive file system. If you run:

 git reset branch --head 

for a case-sensitive file system, this is not the same as being done:

 git reset BRANCH --hard 

Since links are often stored in the file system (in the .git/refs/heads folder), case sensitivity of the file system comes into play. In a case-sensitive file system, .git/refs/heads/branch and .git/refs/heads/branch are two different files.

Please note that even in a case-insensitive file system, your links may end up being "packed" in the file specified by the link in the line. In this case, your links are always case sensitive, regardless of your file system.

+5
source

Source: https://habr.com/ru/post/989894/


All Articles