git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Case rename not detected
@ 2015-05-05  5:52 Orgad Shaneh
  2015-05-05  6:17 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Orgad Shaneh @ 2015-05-05  5:52 UTC (permalink / raw)
  To: git

Hi,

File case rename is not detected correctly on case-insensitive
filesystems. git mv does support it though.

Example:

git init
echo hello > foo
git add foo
git commit -m initial
mv foo Foo
git status # No changes
git add . -A # Doesn't add anything

- Orgad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Case rename not detected
  2015-05-05  5:52 Case rename not detected Orgad Shaneh
@ 2015-05-05  6:17 ` Junio C Hamano
  2015-05-05  6:27   ` Orgad Shaneh
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2015-05-05  6:17 UTC (permalink / raw)
  To: Orgad Shaneh; +Cc: git

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.

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

> git add . -A # Doesn't add anything
>
> - Orgad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Case rename not detected
  2015-05-05  6:17 ` Junio C Hamano
@ 2015-05-05  6:27   ` Orgad Shaneh
  2015-05-06 20:00     ` Torsten Bögershausen
  0 siblings, 1 reply; 4+ messages in thread
From: Orgad Shaneh @ 2015-05-05  6:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Thanks for the fast response!

On Tue, May 5, 2015 at 9:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Case rename not detected
  2015-05-05  6:27   ` Orgad Shaneh
@ 2015-05-06 20:00     ` Torsten Bögershausen
  0 siblings, 0 replies; 4+ messages in thread
From: Torsten Bögershausen @ 2015-05-06 20:00 UTC (permalink / raw)
  To: Orgad Shaneh, Junio C Hamano; +Cc: git

On 2015-05-05 08.27, Orgad Shaneh wrote:
> Thanks for the fast response!
> 
> On Tue, May 5, 2015 at 9:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> 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.
> 
>>
>> 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
You can use 
git -c core.ignorecase=false status

It will report Foo as untracked

foo is not reported as missing, because the underlying OS
says "foo" is there when Git does a stat("Foo")

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-06 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05  5:52 Case rename not detected Orgad Shaneh
2015-05-05  6:17 ` Junio C Hamano
2015-05-05  6:27   ` Orgad Shaneh
2015-05-06 20:00     ` Torsten Bögershausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).