git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Case rename not detected

From
Orgad Shaneh <orgads@gmail.com>
Date
May 5, 2015, 06:27 UTC
Message-ID
<CAGHpTBLMDaKUFVwbeqhKitYLL6Ufp7EkPRc5mjq7yN2gE=RmUg@mail.gmail.com>
In-Reply-To
<xmqqzj5jeeek.fsf@gitster.dls.corp.google.com>
Thanks for the fast response!
On Tue, May 5, 2015 at 9:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Orgad Shaneh <orgads@gmail.com> writes:
>
>> File case rename is not detected correctly on case-insensitive
>> filesystems. git mv does support it though.
>
> It is a very much deliberate design decision to keep the case
> recorded in the index on case insensitive filesystems, where people
> can screw up the case of files they obtained from the project
> without even meaning to do so, as these filesystems and tools on
> them can carelessly change cases---after all, the case doesn't
> matter to these tools, but the people who interact with your work
> result via Git do---so we trust what Git initially gave you
> (e.g. via "checkout") more than the filesystem.

Can you name tools that change file case without notifying the user? I'm not aware of any.

Show 13 quoted lines
>
> To effect the same as "git mv" at the end-user level, you would need
> to remove the entry from the index and re-add it.  I.e.
>
>> git init
>> echo hello > foo
>> git add foo
>> git commit -m initial
>> mv foo Foo
>> git status # No changes
>
> git rm --cached foo ;# Foo should also work here, I think
> git add Foo ;# you should not say 'foo' here

This is very involved, and the user must be aware of the rename while committing. I usually trust git to find differences on its own, without needing my help.

We ran into this problem with a real project, which is mostly developed on Windows machines, but built on linux, where case matters.

One file was committed as Foo.cpp on the filesystem but as foo.cpp in the Makefile. Then in a subsequent commit it was supposed to be renamed foo.cpp, but it wasn't due to this bug.

- Orgad
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 3 of 4 in “Case rename not detected”
  1. Orgad ShanehMay 5, 2015
  2. Junio C HamanoMay 5, 2015
  3. Orgad ShanehMay 5, 2015
  4. Torsten BögershausenMay 6, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.