threads / discuss / 23569

Problems with file name case on Windows.

Subject: Problems with file name case on Windows.

## tl;dr

4 messages between Apr 22, 2010 and Apr 23, 2010.

replies: 3people: 3as markdown or json

martinvz· Apr 22, 2010, 20:54 UTC · lore

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.

-- 
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.
Tay Ray Chuan· Apr 23, 2010, 03:48 UTC · re: martinvz · lore

Re: Problems with file name case on Windows.

Hi,

On Fri, Apr 23, 2010 at 4:54 AM, martinvz <martin.von.zweigbergk@gmail.com> wrote:

> 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
?
-- 
Cheers,
Ray Chuan
Johannes Sixt· Apr 23, 2010, 06:38 UTC · re: martinvz · lore

Re: Problems with file name case on Windows.

Am 22.04.2010 22:54, schrieb martinvz:
Show 5 quoted 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
martinvz· Apr 23, 2010, 12:16 UTC · re: Johannes Sixt · lore

Re: Problems with file name case on Windows.

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
-- 
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.

← back to recent threads