git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org, Tom Prince <tom.prince@ualberta.net>
Subject: Re: [PATCH] Keep rename/rename conflicts of intermediate merges while doing recursive merge
Date: Sat, 31 Mar 2007 13:03:43 -0700	[thread overview]
Message-ID: <7vwt0xuqn4.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070331114938.GB4377@steel.home> (Alex Riesen's message of "Sat, 31 Mar 2007 13:49:38 +0200")

Alex Riesen <raa.lkml@gmail.com> writes:

> This patch leaves the base name in the resulting intermediate tree, to
> propagate the conflict from intermediate merges up to the top-level merge.
> ---

I've eyeballed not your patch but the entire merge-recursive
again, to make sure that the codepath you are touching is the
only one that can potentially leave higher stages in the index
for intermediate merge.  Anything that calls update_file() for
intermediate merge ends up doing add_cacheinfo() hence drops
higher stages for that path, and it seems that the function you
are changing, conflict_rename_rename, is the only one that
leaves unmerged entries in the tree, so I think thi is good.
The assertion you added to git_write_tree() is good way to catch
if the above assumption was wrong and we missed other codepaths.

> The result seem to be at least predictable. Still, doesn't it mean
> that once a rename/rename conflict is in it has to be resolved
> manually forever?

That's certainly better than segfaulting, and in my opinion, it
is much better than silently giving a wrong merge result
assuming one conflict resolution.

We've been resolving other cases that we should not usually
resolve for intermediate merges, leaning on the safer side.  For
example, look at what delete/modify does for an intermediate
merge.  It leaves the modified contents in the index.

The reason an intermediate merge conflicts is because the two
branches resolved the same (not necessarily "exactly the same")
merges differently earlier.  That means the two people who made
those ancestor merges could not agree on something.  Because
they could not agree on, you end up being responsible for
reconciling their differences in opinion.  I do not think it is
a bad thing -- in fact, I even think it is a good thing.  Forks
do not have to converge and you have an opportunity to decide
which side you are on for yourself.

An illustration.

Suppose there is a project that has incorrect documentation, and
Alice and Bob worked on it separately.  Alice finds the
documentation's language horrible and makes typofixes, while in
Bob's opinion its contents, even if its language were to be
improved, keeping the incorrect documentation spreads
misinformation and it is worthless.  Bob deletes the incorrect
documentation and keeps working on other things.

         .------------A1--A2------------A
        /   modify doc \ / take "modify"
       /                X  and later improve          
      /                / \           
  ---o---------------B1---B2------------B
           delete doc     take "delete"

In short, Alice modified and Bob deleted, and reached point A1
and B1, respectively.

Now Alice pulls from Bob, hand-resolves the delete/modify and
improves the contents to make it not just language clean (which
she did in the previous steps leading to A1) but technically
accurate.  She now is at point A2, but haven't pushed her
changes out yet.  She continues to work and reaches A

In the meantime Bob is making further changes to the parts of
the system the documentation used to describe.  Bob commits his
changes, pulls from Alice's last published one A1, and gets
delete/modify conflict in the doc, and he takes the deletion and
merge result is B2.  He continues to work and reaches B.

Later Charlie clones from Bob's B, and tries to merge from
Alice's A.  There are two merge bases (A1 and B1), so an attempt
to merge the merge bases is made by recursive.  This gives
delete/modify conflict.  We leave the modified contents in this
intermediate "virtual ancestor" tree, but the end result is that
Charlie has a chance to resolve this delete/modify conflict
Alice and Bob could not agree on for himself.

If Charlie thinks the same way as Alice and it is a good idea to
keep the documentation up to date, he might do something like
Alice did at A2.  If on the other hand Charlie agrees with Bob
at B2, he might take delete.  I think leaving that decision up
to Charlie is not necessarily a bad thing.

  parent reply	other threads:[~2007-03-31 20:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-29  7:50 SEGV in git-merge recursive: Tom Prince
2007-03-29  8:18 ` Alex Riesen
2007-03-29  8:32   ` Tom Prince
2007-03-29 11:29 ` Alex Riesen
2007-03-29 12:58   ` Tom Prince
2007-03-29 13:34     ` Alex Riesen
2007-03-29 14:12       ` Tom Prince
2007-03-29 14:44         ` Alex Riesen
2007-03-29 14:45           ` Alex Riesen
2007-03-29 15:04             ` Tom Prince
2007-03-29 15:04           ` Alex Riesen
2007-03-29 18:32             ` Alex Riesen
2007-03-29 18:55               ` Alex Riesen
2007-03-29 23:01                 ` [PATCH] An attempt to resolve a rename/rename conflict in recursive merge Alex Riesen
2007-03-29 23:13                   ` Alex Riesen
2007-03-29 19:34               ` SEGV in git-merge recursive: Linus Torvalds
2007-03-29 19:40                 ` Linus Torvalds
2007-03-29 20:44                   ` Alex Riesen
2007-03-30 21:00                   ` Johannes Schindelin
2007-03-31  0:35                     ` Linus Torvalds
2007-03-31  1:03                       ` Linus Torvalds
2007-03-31 10:49                         ` Alex Riesen
2007-03-31 11:49                           ` [PATCH] Keep rename/rename conflicts of intermediate merges while doing recursive merge Alex Riesen
2007-03-31 12:06                             ` Jakub Narebski
2007-03-31 12:50                             ` Johannes Schindelin
2007-03-31 12:53                               ` Johannes Schindelin
2007-03-31 16:07                             ` Linus Torvalds
2007-03-31 17:34                               ` Alex Riesen
2007-03-31 20:03                             ` Junio C Hamano [this message]
2007-03-31 11:22                       ` SEGV in git-merge recursive: Johannes Schindelin
2007-03-29 19:55               ` Tom Prince

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=7vwt0xuqn4.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    --cc=tom.prince@ualberta.net \
    --cc=torvalds@linux-foundation.org \
    /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).