Re: Confusion about content of conflicted file after : git remove/add

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

 



On Thu, Jun 24, 2010 at 10:23:49AM +0530, Sabyasachi Ruj wrote:

> I have asked the question in detail in Stack Overflow.
> http://stackoverflow.com/questions/3100032/git-rename-delete-confusion
> Can anyone here explain that situation. Please also read the comments
> I wrote there.
> 
> I am totally baffled and can't predict what will be the content of a
> file after "git rm and git add" in branch and "git mv" in another
> branch.

Those two actions are the same. So there would be no conflict. But in
the situation you gave at stackoverflow, it is not just "git rm and git
add" versus "git mv". On one side, you actually change the file entirely
(well beyond what any rename detection could guess at, as you rewrite
the single line in the file).

So your situation is "moved file" versus "moved and changed file". You
get a rename/delete conflict because one side renamed the file, but the
other side apparently deleted it (because we cannot link the old "a" to
the new "b", as they are too different).

We seem to mark this in the index as:

  1. "a" is totally gone. This makes some sense, as it did go away on
     both sides, but given that it is part of a conflict-causing rename,
     I wonder if it should simply stay.

  2. We mark "b" as unmerged, but only put the "renamed to" entry in
     stage 3. For a pure rename/delete conflict, this makes sense. But
     this _isn't_ purely that. We also add "b" on our branch, so there
     should be a further rename/add conflict, but we never see it. At
     the very least, the new contents of "b" should go into stage 2 of
     the index.

So I think there may be a bug. I don't really see any code in
merge-recursive.c to handle conflicts on _both_ sides of a rename, but
obviously that is possible here.

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