From: Jeff King <peff@peff.net>
To: Sabyasachi Ruj <ruj.sabya@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Confusion about content of conflicted file after : git remove/add
Date: Thu, 24 Jun 2010 02:10:29 -0400 [thread overview]
Message-ID: <20100624061029.GA11020@coredump.intra.peff.net> (raw)
In-Reply-To: <AANLkTimqrfeNEmlfHGxWTdLgS7tAMOA66N4nV8b5I8F6@mail.gmail.com>
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
next prev parent reply other threads:[~2010-06-24 6:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-24 4:53 Confusion about content of conflicted file after : git remove/add Sabyasachi Ruj
2010-06-24 6:10 ` Jeff King [this message]
[not found] ` <AANLkTilo0b9aL3oxk0b8eNkBWygwA7xSclTy1MaK8qba@mail.gmail.com>
2010-06-25 5:36 ` Sabyasachi Ruj
2010-06-26 5:58 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100624061029.GA11020@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=ruj.sabya@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).