]> git.ipfire.org Git - thirdparty/git.git/commit - read-cache.c
Support case folding for git add when core.ignorecase=true
authorJoshua Jensen <jjensen@workspacewhiz.com>
Sun, 3 Oct 2010 09:56:45 +0000 (09:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Oct 2010 18:19:59 +0000 (11:19 -0700)
commitdc1ae7048794ba15b514ca1a67f50163a2e48eb8
treea60e4b698af28e7b566cd53057c5061d94439604
parent21444f1805d2ea3c7b297101e9470048cdcf58d2
Support case folding for git add when core.ignorecase=true

When MyDir/ABC/filea.txt is added to Git, the disk directory MyDir/ABC/
is renamed to mydir/aBc/, and then mydir/aBc/fileb.txt is added, the
index will contain MyDir/ABC/filea.txt and mydir/aBc/fileb.txt. Although
the earlier portions of this patch series account for those differences
in case, this patch makes the pathing consistent by folding the case of
newly added files against the first file added with that path.

In read-cache.c's add_to_index(), the index_name_exists() support used
for git status's case insensitive directory lookups is used to find the
proper directory case according to what the user already checked in.
That is, MyDir/ABC/'s case is used to alter the stored path for
fileb.txt to MyDir/ABC/fileb.txt (instead of mydir/aBc/fileb.txt).

This is especially important when cloning a repository to a case
sensitive file system. MyDir/ABC/ and mydir/aBc/ exist in the same
directory on a Windows machine, but on Linux, the files exist in two
separate directories. The update to add_to_index(), in effect, treats a
Windows file system as case sensitive by making path case consistent.

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>
read-cache.c