Re: git mv messed up file mapping if folders contain identical files

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

 



On Thu, Feb 25, 2016 at 3:49 AM, Kevin Daudt <me@xxxxxxxxx> wrote:
> On Wed, Feb 24, 2016 at 04:38:11PM -0700, Bill Okara wrote:
>> Hi,
>>
>> I noticed the following 'git mv' issue with:
>> git version 2.6.4
>>
>>
>> If there are identical files in different subfolders, 'git mv' the
>> root folder (and/or each file individually) will mess up the file path
>> mapping. that is, if having identical 'content.txt' file under
>> gitmvtest
>>     |--demo/content.txt
>>     |--dev/content.txt
>>     |--prod/content.txt
>>
>> after doing the "git mv gitmvtest/resources
>> gitmvtest/src/main/resources", the 'git status' will show:
>>
>> renamed:    gitmvtest/resources/demo/content.txt ->
>> gitmvtest/src/main/resources/demo/content.txt
>> renamed:    gitmvtest/resources/prod/content.txt ->
>> gitmvtest/src/main/resources/dev/content.txt            <== NOTE:
>> wrongly mapped the prod/content.txt to dev/content.txt
>> renamed:    gitmvtest/resources/dev/content.txt ->
>> gitmvtest/src/main/resources/prod/content.txt            <== NOTE:
>> wrongly mapped the dev/content.txt to prod/content.txt
>>
>> I tried running 'git mv' on each file individually, got the same problem:
>> > git mv gitmvtest/resources/demo/content.txt gitmvtest/src/main/resources/demo/content.txt
>> > git mv gitmvtest/resources/dev/content.txt gitmvtest/src/main/resources/dev/content.txt
>> > git mv gitmvtest/resources/prod/content.txt gitmvtest/src/main/resources/prod/content.txt
>>
>> > git status
>> renamed:    gitmvtest/resources/demo/content.txt ->
>> gitmvtest/src/main/resources/demo/content.txt
>> renamed:    gitmvtest/resources/prod/content.txt ->
>> gitmvtest/src/main/resources/dev/content.txt          <== WRONG
>> renamed:    gitmvtest/resources/dev/content.txt ->
>> gitmvtest/src/main/resources/prod/content.txt          <== WRONG
>>
>>
>> NOTE:
>> =======
>> if modified the content.txt in the 3 folders to contain different
>> data, then repeating the above 'git mv' will produce correct result,
>>
>> renamed:    gitmvtest/resources/demo/content.txt ->
>> gitmvtest/src/main/resources/demo/content.txt       <== CORRECT
>> renamed:    gitmvtest/resources/dev/content.txt ->
>> gitmvtest/src/main/resources/dev/content.txt             <== CORRECT
>> renamed:    gitmvtest/resources/prod/content.txt ->
>> gitmvtest/src/main/resources/prod/content.txt          <== CORRECT
>>
>>
>>
>> just want to see if this is a bug, user error (on my end), or??
>>
>
> This looks like the same issue as submodule--helper list has:
> http://article.gmane.org/gmane.comp.version-control.git/287227

The submodule--helper is not called from within git-mv, so it may be
a similar but not the same issue. ;)

Looking through the code, the pathspec is not treated according to the newest
style convention, I think it is one of the last places where the
pathspec internals
are poked with, instead of using parse_parsespec && match_parsespec.
(That said it is very old hence often tested code in the wild. old
code != bad code)

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