From: Junio C Hamano <gitster@pobox.com>
To: Johan Herland <johan@herland.net>
Cc: Antoine Pelisse <apelisse@gmail.com>,
Michael Haggerty <mhagger@alum.mit.edu>,
Jeff King <peff@peff.net>, git <git@vger.kernel.org>
Subject: Re: Premerging topics
Date: Tue, 23 Apr 2013 07:53:39 -0700 [thread overview]
Message-ID: <7vwqrtl2mk.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALKQrgfO9fd+EEA=Vwe94tJbxkX89uDmMHm9rj6L=d4x7JJjaQ@mail.gmail.com> (Johan Herland's message of "Tue, 23 Apr 2013 08:34:42 +0200")
Johan Herland <johan@herland.net> writes:
> Can you solve this problem with a tree object, instead of inventing a
> specially-formatted blob?
Hmm. What problem are you guys trying to solve?
I think Michael's use of a merge commit to record a merge result is
sufficient as a means to record how to recreate an evil merge.
http://thread.gmane.org/gmane.comp.version-control.git/212570/focus=212578
FWIW, in the [RFD], I wasn't asking for ideas on that part. When
rebuiling 'pu', I use an even simpler solution to have rerere
autoresolve the mechanical part of the merge, and then cherry-pick a
separate commit from refs/merge-fix/ hierarchy on the result, and it
works perfectly fine (this is done by the 'Reintegrate' script on
the 'todo' branch; see Documentation/howto/maintain-git.txt).
When topic A is closer to be done than topic B (in other words, when
I merge topic B to an integration branch, topic A is already merged
there), and these topics have semantic conflicts (e.g. A renames a
function foo() to bar(), while B adds a new callsite of foo()), a
mechanical merge of B may succeed without any textual conflict (or
if there is, rerere can resolve it), but a semantic fix-up needs to
do "s/foo/bar/g" on the result.
I would do something like this for the first time:
... while on 'pu', A has already been merged ...
git merge B ;# may conflict
edit textual conflicts away
git rerere ;# remember the textual resolution
git commit ;# commit _without_ semantics adjustment
edit semantic conflict away, i.e. s/foo/bar/g
git commit
git update-ref refs/merge-fix/B
After that, next time I rebuild 'pu', when the automated procedure
processes B, it would "git merge B", "git rerere", make sure textual
conflicts are gone, and "git cherry-pick refs/merge-fix/B". To make
sure this would work, what I typically do immediately after doing
all of the above is:
git reset --hard HEAD^^
to drop the fix-up commit and merge of B, and actually tell the
automated procedure to process B. It should recreate the evil merge
using the information I just recorded.
So "how a recipe to recreate an evil merge is recorded", as far as I
am concerned, is an already solved problem.
The part of the existing solution I was not happy was deciding when
to use which "merge-fix" commit to cherry-pick. If I start merging
topic B before topic A, the "merge-fix/B" needs to be renamed to
"merge-fix/A" in the above. Otherwise, when B is merged to 'pu',
there is no 'A' merged to it yet, so merge-fix that munges its new
call to foo() to call bar() instead will _break_ things [*1*].
And that was why I wanted to have a data structure that is quick to
query to answer "I am about to merge B. Does the history already
have an A for which I have recorded a merge-fix for <A,B> pair?"
[Footnote]
*1* If A has other kinds of conflicts with other topics, it is not
sufficient to just rename "merge-fix/B" to "merge-fix/A"---the
effect of cherry-picking "merge-fix/B" needs to be merged to
existing "merge-fix/A". If a merge-fix is recorded for a pair of
commits that necessitates an evil merge, this naturally goes away.
I can keep a merge-fix for the <A,B> pair whether I merge A before
or after B, and semantic conflicts A may have with another topic C
would be stored in a separate merge-fix for <A,C> pair.
next prev parent reply other threads:[~2013-04-23 14:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 20:35 Premerging topics (was: [RFD] annnotating a pair of commit objects?) Antoine Pelisse
2013-04-22 9:23 ` Antoine Pelisse
2013-04-23 6:34 ` Johan Herland
2013-04-23 14:51 ` Antoine Pelisse
2013-04-23 23:06 ` Johan Herland
2013-04-24 5:48 ` Premerging topics Junio C Hamano
2013-04-24 6:22 ` Johan Herland
2013-04-24 7:14 ` Junio C Hamano
2013-04-29 19:06 ` Antoine Pelisse
2013-04-29 22:19 ` Junio C Hamano
2013-04-29 13:04 ` Antoine Pelisse
2013-04-29 15:08 ` Junio C Hamano
2013-04-23 14:53 ` Junio C Hamano [this message]
2013-04-23 15:17 ` Antoine Pelisse
2013-04-23 15:29 ` Junio C Hamano
2013-04-23 15:36 ` Antoine Pelisse
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vwqrtl2mk.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=johan@herland.net \
--cc=mhagger@alum.mit.edu \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).