Skip to contentSkip to conversation

Problems with file name case on Windows.

DISCUSSION martinvz 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

martinvz

author
#0 lore raw

Under Cygwin, if you add a file "a" in one commit, then rename the file to "A" and commit again, both files will be in the new commit. Running the following line under Cygwin produces a commit with both files ("a" and "A"). Running it on Linux produces a commit with one file ("A"), as expected.

git init; git config core.ignorecase false; touch a; git add a; git commit -m a; mv a A; git add -A; git commit -m A

The problem seems to be with the "git add -A" part, since it is possible to get around the problem by running "git add A" followed by "git rm a" (or by using lower-level commands, I suppose). What are the chances of getting this fixed? It's mostly annoying when importing existing code where it's harder to use the add-rm workaround, since you don't know which files have changed file name case.

Signature · 2 lines
View this message in context: http://git.661346.n2.nabble.com/Problems-with-file-name-case-on-Windows-tp4947131p4947131.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw

Am 22.04.2010 22:54, schrieb martinvz:

Quoted 5 lines

Under Cygwin, if you add a file "a" in one commit, then rename the file to "A" and commit again, both files will be in the new commit. Running the following line under Cygwin produces a commit with both files ("a" and "A"). Running it on Linux produces a commit with one file ("A"), as expected.

The safe way to achieve your goal is:

git mv a b
git mv b A
git commit

-- Hannes

author
#2 lore raw

Thanks, I had forgotten about "git mv". Still, when you receive just a tarball of code (actually from another VCS in my case), you would have to figure out which files had been renamed, before you could run the command, so it is not very useful in scripting in this case. Maybe what I could/should do is something like "git rm -rf *; <untar> ; git add -A"?

/Martin

Signature · 2 lines
View this message in context: http://git.661346.n2.nabble.com/Problems-with-file-name-case-on-Windows-tp4947131p4950180.html
Sent from the git mailing list archive at Nabble.com.
#3 lore raw
In reply to martinvz

Hi,

Quoted 2 lines · martinvz

git init; git config core.ignorecase false; touch a; git add a; git commit -m a; mv a A; git add -A; git commit -m A

Have you tried

git mv a A; git commit -m A

instead of

mv a A; git add -A; git commit -m A

?

Signature · 2 lines
Cheers,
Ray Chuan