Git development
 help / color / mirror / Atom feed
From: "Raimund Berger" <raimund.berger@gmail.com>
To: git@vger.kernel.org
Subject: Re: Newbie question regarding 3way merge order.
Date: Mon, 02 Feb 2009 19:15:30 +0100	[thread overview]
Message-ID: <87wsc8aenx.fsf@gigli.quasi.internal> (raw)
In-Reply-To: <49871ADA.4080905@viscovery.net> (Johannes Sixt's message of "Mon, 02 Feb 2009 17:10:02 +0100")

Johannes Sixt <j.sixt@viscovery.net> writes:

> Please don't set Mail-Followup-To: here, and keep the Cc: list.
>
> Raimund Berger schrieb:
>> do the following conditions hold
>> 
>> (i)  A+B == B+A for all commits A,B
>> (ii) (A+B)+C == A+(B+C) for all A,B,C
>> 
>> where "+" designates the standard git 3way merge?
>
> I don't think that (ii) does holds in general.
>
> [ In the examples consider each letter/symbol on a line by itself; this
> saves vertical space. ]
>
> Start with this (the merge base):
>
> 	f(a)
>
> and there are three topic branches growing from here:
> A makes this (rename f->g):
>
> 	g(a)
>
> B makes this (add another f):
>
> 	f(a)f(b)
>
> C makes this (renames a->c):
>
> 	f(c)
>
> Then A+B is
>
> 	g(a)f(b)
>
> A+C is
>
> 	g(c)
>
> B+C is
>
> 	f(c)f(b)
>
> (A+B)+C is
>
> 	g(c)f(b)
>
> but A+(B+C) is ambiguous:
>
> 	g(c)f(b)
> or
> 	f(c)g(b)
>
> -- Hannes


Are you sure you're not making assumptions about "obvious" manual
resolutions? E.g. I can't quite see how A+B, which is

      g(a)----
     /        \
 f(a)          g(a)f(b) or f(a)f(b) ???
     \        /
      f(a)f(b)

would not be flagged as a conflict regarding f(a) vs. g(a).

Now, you may assume that because B leaves f(a) as it is while A changes
f(a) into g(a) that both, that change and the addition of f(b) in B,
should survive the merge. But the actual algorithm couldn't possibly
know and decide that. Same goes for other merges you do there. In fact,
in strict terms of how I defined equality, you didn't give a counter
example because neither (A+B)+C or A+(B+C) automatically resolve. It
would have been if one of them did.

And that's why I specifically "limited" my equality relation to
automatic resolutions, to simplify the discussion and deal with kind of
minimum requirements first. I didn't even mention that originally
because I felt it was so obvious.

So only the next step would be looking at how manual resolutions play
into this, and while that might be fairly intuitive in the A+B == B+A
commutativity case, associativity of course is kind of a different
ballpark. Although I'd expect somebody intimately acquainted with
merging techniques capable of maybe giving a hint or two even in that
case.

  reply	other threads:[~2009-02-02 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29 22:25 Newbie question regarding 3way merge order Raimund Berger
2009-01-30 11:37 ` Raimund Berger
2009-01-30 17:31 ` Sitaram Chamarty
2009-01-30 19:09   ` Raimund Berger
2009-01-31  0:32     ` Sitaram Chamarty
2009-01-31 13:26       ` Raimund Berger
2009-01-31 21:45         ` Nanako Shiraishi
2009-02-01 14:13           ` Raimund Berger
2009-02-01 19:22   ` Junio C Hamano
2009-02-02  1:50     ` Sitaram Chamarty
2009-02-02 14:58     ` Raimund Berger
2009-02-02 16:10       ` Johannes Sixt
2009-02-02 18:15         ` Raimund Berger [this message]
2009-02-03  7:21           ` Johannes Sixt
2009-01-31  0:57 ` Nanako Shiraishi
2009-01-31 13:14   ` Raimund Berger

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=87wsc8aenx.fsf@gigli.quasi.internal \
    --to=raimund.berger@gmail.com \
    --cc=git@vger.kernel.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