Re: Does changing filename case breaks git's rename heuristic?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Loewenherz venit, vidit, dixit 27.08.2010 16:52:
> On Fri, Aug 27, 2010 at 1:00 AM, Michael J Gruber
> <git@xxxxxxxxxxxxxxxxxxxx> wrote:
>> Dan Loewenherz venit, vidit, dixit 27.08.2010 06:57:
>>> Hi all,
>>>
>>> I may be mistaking a design decision as a bug, but I wanted to throw
>>> this out to the list to make sure. I think that re-enacting it will be
>>> the best way to explain it.
>>>
>>> $ mkdir test
>>> $ cd test
>>> $ git init
>>> $ cat > readme
>>> This is a test file.
>>> ^D
>>> $ git commit -am "first commit"
>>> [master (root-commit) fae0d05] first commit
>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> ? You have not added any file, so git won't commit anything (not even
>> with -a). The above can't be a complete transcription. I assume you've
>> added readme with the content above.
> 
> Yep, that was my mistake. I left out 'git add readme'.
> 
>>
>>>
>>> For personal reasons, I now want readme to be uppercase.
>>>
>>> $ mv readme README
>>
>> Here's where using "git mv" would have been the easier choice, followed
>> by commit.
> 
> I agree. The instance where this actually occurred was that I had
> received an updated binary file to put into my repository. icon.png ->
> Icon.png. I suppose I could've run 'git mv' but I didn't realize what
> would happen if I didn't!
> 
>>
>>> $ cat > README
>>> This is the revised README.
>>
>> Renaming and changing the content completely in one step will always
>> trip up git's rename detection. You should rename, commit, change,
>> commit, unless the change affects a small portion of the file only.
> 
> Agreed.
> 
>>
>>> $ git status -sb
>>> ## master
>>>  M readme
>>
>> Again, this can't be a complete transcript. The above would lead to
>>
>>  D readme
>> ?? README
> 
> This is where I didn't botch up the transcript, and where I was
> actually surprised at what was going on. I'll insert a full one at the
> bottom of this email that can actually be run to get the same results.
> 
>>
>>> $ git add README
>>> $ git status -sb
>>> ## master
>>>  M readme
>>>
>>> At this point, I'm thinking that git is confused. Even though I've
>>
>> Are you possibly using a case-challenged file system? Is this maybe on a
>> Mac with HFS or Win with NTFS?
> 
> I'm using a Mac with a journaled filesystem and Git version 1.7.2.1.

The journalling is no problem, but HFS is. I'm no Macxpert but if I
remember correctly, then under HFS "readme" and "README" are the same
file, i.e. HFS only remembers how you want it spelled. People will
correct me where I'm wrong.

Your test script should produce the expected result if you use, say,
"readme" and "RAEDME" , i.e. names which differ by more than just case.

Cheers,
Michael

> Transcript
[snipped]
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]