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: Fri, 30 Jan 2009 20:09:56 +0100	[thread overview]
Message-ID: <87vdrwbofv.fsf@gigli.quasi.internal> (raw)
In-Reply-To: <slrngo6eat.s1d.sitaramc@sitaramc.homelinux.net> (Sitaram Chamarty's message of "Fri, 30 Jan 2009 17:31:09 +0000 (UTC)")


Sitaram Chamarty <sitaramc@gmail.com> writes:

> [replying only because no one else did; caveat reader!]
>
> On 2009-01-29, Raimund Berger <raimund.berger@gmail.com> wrote:
>
>> The question is whether a (3way) merge is commutative, purely in terms
>> of content (i.e. disregarding commit history for now). Iow if no matter
>> in which order I merge A and B, i.e. A into B or B into A, I'd be
>> guaranteed to arrive at the same content.
>
> I'd say yes.  Finding the common ancestor and then applying
> the differences from both sides are operations that do not
> appear to be order dependent.

That's exactly the point which I'd like to have clarified.

E.g. with A, B and ancestor C, the merging and conflict resolution
algorithm had to be completely symmetric if diff(A,C)+diff(B,C) applied
to C should always be the same as diff(B,C)+diff(A,C) applied to C.

So I'm really asking if that is a fact upon which I can rely.

>
>> If yes, a followup question would be if the merge machinery sitting
>> beneath rebase is exactly the same as that of a standard merge.
>
> The merge "machinery" can be explicitly chosen using the
> "-s" (strategy) option, but for the same chosen strategy, I
> think yes it would be the same for a merge as for a rebase.

An interesting hint. Up to now, I assumed that rebase would always
perform implicit merging strategies. I mean what else would one expect
in the above picture to happen when rebasing A on B? I'd assume it'd
produce the same tree as a merge of A into B, by employing exactly the
same machinery. E.g. fast forward of C to B, then merge A in. So that,
effectively, the only difference between rebase and merge is just commit
history but not (tree) content.

>From reading the rebase man page though it seems that merging machinery
has to be explicitly requested via '-m'. Which makes me wonder how the
default rebase actually works.

>
>> The reason I ask is obvious I guess. What basically interests me is if I
>> gave a bunch of topic branches exposure on a test branch and, after
>> resolving issues, applied them to stable, that I could be 100% sure to
>> not introduce new issues content wise just by applying merges in a
>> different order or form (rebase, patch set).
>
> That appears to be a different question than the one you
> started with.
>
> Reversing A and B is one thing, applying a sequence of
> merges in a different order is quite something else.

Mathematically speaking, if A1 and A2 commute with regard to a binary
operation, A1 ... An do as well. So I'd still think the latter question
boils down to the commutativity question above *iff* rebase actually
does an implicit merge by default. Which I'm now led to question.

Thanks for you answer, much appreciated.

  reply	other threads:[~2009-01-30 19:11 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 [this message]
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
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=87vdrwbofv.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