git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Confusion about content of conflicted file after : git remove/add
@ 2010-06-24  4:53 Sabyasachi Ruj
  2010-06-24  6:10 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Sabyasachi Ruj @ 2010-06-24  4:53 UTC (permalink / raw)
  To: git

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.

--
Sabyasachi

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

* Re: Confusion about content of conflicted file after : git remove/add
  2010-06-24  4:53 Confusion about content of conflicted file after : git remove/add Sabyasachi Ruj
@ 2010-06-24  6:10 ` Jeff King
       [not found]   ` <AANLkTilo0b9aL3oxk0b8eNkBWygwA7xSclTy1MaK8qba@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2010-06-24  6:10 UTC (permalink / raw)
  To: Sabyasachi Ruj; +Cc: git

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

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

* Re: Confusion about content of conflicted file after : git remove/add
       [not found]   ` <AANLkTilo0b9aL3oxk0b8eNkBWygwA7xSclTy1MaK8qba@mail.gmail.com>
@ 2010-06-25  5:36     ` Sabyasachi Ruj
  2010-06-26  5:58       ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Sabyasachi Ruj @ 2010-06-25  5:36 UTC (permalink / raw)
  To: Jeff King; +Cc: git

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

Then I guess having contents of both the files would be an expected
behavior. Should I report a bug somewhere?
-
Sabyasachi

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

* Re: Confusion about content of conflicted file after : git remove/add
  2010-06-25  5:36     ` Sabyasachi Ruj
@ 2010-06-26  5:58       ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2010-06-26  5:58 UTC (permalink / raw)
  To: Sabyasachi Ruj; +Cc: git

On Fri, Jun 25, 2010 at 11:06:46AM +0530, Sabyasachi Ruj wrote:

> >> 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.
> 
> Then I guess having contents of both the files would be an expected
> behavior. Should I report a bug somewhere?

I would certainly expect it (at least in the index). Posting here is
fine to report, but you may want to repost with a more descriptive
subject line and a summary of the issue. That will get the attention of
people interested in merge issues.

-Peff

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

end of thread, other threads:[~2010-06-26  5:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-24  4:53 Confusion about content of conflicted file after : git remove/add Sabyasachi Ruj
2010-06-24  6:10 ` Jeff King
     [not found]   ` <AANLkTilo0b9aL3oxk0b8eNkBWygwA7xSclTy1MaK8qba@mail.gmail.com>
2010-06-25  5:36     ` Sabyasachi Ruj
2010-06-26  5:58       ` Jeff King

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