From: Junio C Hamano <junkio@cox.net>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] rebase: Allow merge strategies to be used when rebasing
Date: Sun, 18 Jun 2006 02:08:04 -0700 [thread overview]
Message-ID: <7vd5d63k7f.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 1150599735483-git-send-email-normalperson@yhbt.net
Eric Wong <normalperson@yhbt.net> writes:
> This solves the problem of rebasing local commits against an
> upstream that has renamed files.
I think leveraging the merge strategy to perform rebase is
sound, but the selection of merge base for this purpose is quite
different from the regular merge, and I think unfortunately this
patch is probably wrong in letting git-merge choose the merge
base.
But let's mention other things as well.
- You kept the original "format-patch piped to am" workflow
optionally working.
- You check if merge or patch was used for failed rebase and
follow the appropriate codepath while resuming, which is
good.
- The list of commits you generate with tac seem to include
merge commit -- you may want to give --no-merges to
rev-list.
- I do not think we use "tac" elsewhere -- is it portable
enough?
- Exiting with success unconditionally after "git am" feels
wrong. I would do "exit $?" instead of "exit 0" there.
Suppose you have this commit ancestry graph:
----------------------------------------------------------------
Example: git-rebase --onto master A topic
A---B---C topic B'--C' topic
/ --> /
D---E---F---G master D---E---F---G master
----------------------------------------------------------------
This is slightly different from the one at the beginning of the
script. The idea is A turned out to be not so cool, and we
would want to drop it.
> +call_merge () {
> + cmt="$(cat $dotest/`printf %0${prec}d $1`)"
> + echo "$cmt" > "$dotest/current"
> + git-merge $strategy_args "rebase-merge: $cmt" HEAD "$cmt" \
> + || die "$MRESOLVEMSG"
> +}
call_merge is first called with B in cmt, and HEAD is pointing
at G. But the merge in this function makes a merge between B
and G, taking the effect of E->A.
I think the three-way merge you would want here is not between B
and G using E as the pivot, but between B and G using A as the
pivot. That's how cherry-pick and revert works. I would
leverage the interface that is one level lower for this -- the
strategy modules themselves.
git-merge-$strategy $cmt^ -- HEAD $cmt
The strategy modules take merge base(s), double-dash as the
separator, our head and the other head. They do not make commit
themselves (instead they leave working tree and index in
committable state) and signal the results with their exit
status:
0 -- success
1 -- conflicts
2 -- did not handle the merge at all
next prev parent reply other threads:[~2006-06-18 9:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-18 3:02 [PATCH] rebase: Allow merge strategies to be used when rebasing Eric Wong
2006-06-18 9:08 ` Junio C Hamano [this message]
2006-06-19 21:39 ` Eric Wong
2006-06-19 21:55 ` Junio C Hamano
2006-06-21 10:01 ` Eric Wong
2006-06-21 10:04 ` [PATCH (fixed)] " Eric Wong
2006-06-21 10:04 ` [PATCH 1/3] " Eric Wong
2006-06-21 10:04 ` [PATCH 3/3] rebase: error out for NO_PYTHON if they use recursive merge Eric Wong
2006-06-21 11:01 ` [PATCH (fixed)] rebase: Allow merge strategies to be used when rebasing Junio C Hamano
2006-06-21 11:01 ` [PATCH] " Junio C Hamano
2006-06-18 11:48 ` [PATCH] Add renaming-rebase test Junio C Hamano
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=7vd5d63k7f.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox