]> git.ipfire.org Git - thirdparty/git.git/commit - dir.c
Add case insensitivity support for directories when using git status
authorJoshua Jensen <jjensen@workspacewhiz.com>
Sun, 3 Oct 2010 09:56:43 +0000 (09:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Oct 2010 18:19:58 +0000 (11:19 -0700)
commit5102c6173c5a1c683dfdd8ccd07528adddd51745
treec36145dd9e065bb9d2011566088044f1d50ff2ae
parent10d4b02b9962170e15d1d65b03581ef8bef66e2e
Add case insensitivity support for directories when using git status

When using a case preserving but case insensitive file system, directory
case can differ but still refer to the same physical directory.  git
status reports the directory with the alternate case as an Untracked
file.  (That is, when mydir/filea.txt is added to the repository and
then the directory on disk is renamed from mydir/ to MyDir/, git status
shows MyDir/ as being untracked.)

Support has been added in name-hash.c for hashing directories with a
terminating slash into the name hash. When index_name_exists() is called
with a directory (a name with a terminating slash), the name is not
found via the normal cache_name_compare() call, but it is found in the
slow_same_name() function.

Additionally, in dir.c, directory_exists_in_index_icase() allows newly
added directories deeper in the directory chain to be identified.

Ultimately, it would be better if the file list was read in case
insensitive alphabetical order from disk, but this change seems to
suffice for now.

The end result is the directory is looked up in a case insensitive
manner and does not show in the Untracked files list.

Signed-off-by: Joshua Jensen <jjensen@workspacewhiz.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c
name-hash.c