I am trying to bring a already existing codebase in version control
system like git
.
I am facing a particular issue where codebase contains two folder with same name but different case like 'Form' and 'form'.
Here is the scenario : Suppose, we have three system Linux ( case sensitive file system ) , MAC ( Not case sensitive ) and WINDOWS ( not case sensitive )
Now if someone on LINUX create a folder name FORM
having files a.php
, b.php
, c.php
and another folder name form
having files a.php
, b.php
, d.php
and pushes it to remote repo
Now when a user on MAC or WINDOWS clone the repo then how will git behave when handling FORM
and form
coming from remote because MAC and WINDOWS are case insensitive
The Windows and macOS file systems are case-insensitive (but case-preserving) by default. Most Linux filesystems are case-sensitive. Git was built originally to be the Linux kernel's version control system, so unsurprisingly, it's case-sensitive.
The cure is to set your ignorecase=false and rename the lowercased files (that git changed that way, not Visual Studio) back to their UsualCase by hand (i.e. 'mv myname MyName').
Yes. Windows (local) file systems, including NTFS, as well as FAT and variants, are case insensitive (normally).
Yes - the repository names are case sensitive.
You must really fix the file names. It may be useful to use
git config core.ignorecase false
Just in case you want to mix the environment. See more in How do I commit case-sensitive only filename changes in Git?
You should rename your folders so that two sibling folders are never identical (with case-insensitive comparison). This will make your code base more portable, and less error-prone, because developers will not confuse one folder with the other.
how will git behave when handling FORM and form coming from remote because MAC and WINDOWS are case insensitive
Better, since Git 2.17 (Q2 2018), because Git will keep track of those folders with different case in all instances.
Before, a "git add
" files in the same directory, but with spelling the directory path in different cases on case insensitive filesystem, corrupted
the name hash data structure and led to unexpected results.
See commit c95525e (08 Feb 2018) by Ben Peart (benpeart
).
(Merged by Junio C Hamano -- gitster
-- in commit 2ac76d8, 27 Feb 2018)
name-hash
: properly fold directory names inadjust_dirname_case()
Correct the pointer arithmetic in
adjust_dirname_case()
so that it callsfind_dir_entry()
with the correct string length.Previously passing in "
dir1/foo
" would pass a length of 6 instead of the correct 4.
This resulted infind_dir_entry()
never finding the entry and so the subsequentmemcpy
that would fold the name to the version with the correct case never executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With