From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Igor Djordjevic <igor.d.djordjevic@gmail.com>
Cc: Sergey Organov <sorganov@gmail.com>,
git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>,
Junio C Hamano <gitster@pobox.com>,
Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [RFC] Rebasing merges: a jorney to the ultimate solution (Road Clear)
Date: Tue, 27 Feb 2018 01:07:01 +0100 (STD)
Message-ID: <nycvar.QRO.7.76.6.1802270051470.56@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <bbe64321-4d3a-d3fe-8bb9-58b600fabf35@gmail.com>
Hi Buga,
On Tue, 20 Feb 2018, Igor Djordjevic wrote:
> I`m really interested in this topic, which seems to (try to) address the
> only "bad feeling" I had with rebasing merges - being afraid of silently
> losing amendments by actually trying to "replay" the merge (where
> additional and possibly important context is missing), instead of really
> "rebasing" it (somehow).
If those amendments are what you are worried about, why not address them
specifically?
In other words, rather than performing the equivalent of
git show <merge>^! | git apply
(which would of course completely ignore if the rewritten <merge>^2
dropped a patch, amended a patch, or even added a new patch), what you
really want is to figure out what changes the user made when merging, and
what merge strategy was used to begin with.
To see what I mean, look at the output of `git show 0fd90daba8`: it shows
how conflicts were resolved. By necessity, this is more complicated than a
simple diff: it is *not* as simple as taking a diff between two revisions
and applying that diff to a third revision. There were (at least) three
revisions involved in the original merge commit, and recreating that merge
commit faithfully means to represent the essence of the merge commit
faithfully enough to be able to replay it on a new set of at least three
revisions. That can be simplified to two-way diffs only in very, very
special circumstances, and in all other cases this simplification will
simply fall on its nose.
If the proposed solution was to extend `git apply` to process combined
diffs, I would agree that we're on to something. That is not the proposed
solution, though.
In short: while I am sympathetic to the desire to keep things simple,
the idea to somehow side-step replaying the original merge seems to be
*prone* to be flawed. Any system that cannot accommodate
dropped/changed/added commits on either side of a merge is likely to be
too limited to be useful.
Ciao,
Johannes