git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	Stephen Haberman <stephen@exigencecorp.com>,
	Andrew Wong <andrew.kw.w@gmail.com>
Subject: Re: [PATCH/RFC] rebase -p: do not redo the merge, but cherry-pick first-parent changes
Date: Tue, 22 May 2012 18:38:21 -0500	[thread overview]
Message-ID: <20120522233821.GA31667@burratino> (raw)
In-Reply-To: <4FBAA33D.1080703@kdbg.org>

Johannes Sixt wrote:

> - The 'git merge' invocation passed the commit message of the old merge
>   commit, but it still obeyed the merge.log option. If it was set, the log
>   ended up twice in the commit message.

Likewise for the "Conflicts:" paragraph, which should also be pretty
simple to fix directly.  I don't think that points directly to a
fundamental flaw in the current implementation, but it does make it
seem like no one has been using "rebase -p" for anything nontrivial. :)

[...]
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -312,12 +312,14 @@ pick_one_preserving_merges () {
>  			msg_content="$(commit_message $sha1)"
>  			# No point in merging the first parent, that's HEAD
>  			new_parents=${new_parents# $first_parent}
> -			if ! do_with_author output \
> -				git merge --no-ff ${strategy:+-s $strategy} -m \
> -					"$msg_content" $new_parents
> +			printf "%s\n" $new_parents >"$GIT_DIR"/MERGE_HEAD
> +			printf "%s\n" "$msg_content" >"$GIT_DIR"/MERGE_MSG
> +			if output git cherry-pick -m 1 -n "$sha1"
>  			then
> +				do_with_author output git commit --no-verify -F "$GIT_DIR"/MERGE_MSG ||
> +					die_with_patch $sha1 "Could not replay merge $sha1"
> +			else
> -				printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
> -				die_with_patch $sha1 "Error redoing merge $sha1"
> +				die_with_patch $sha1 "Could not pick merge $sha1"
>  			fi

Cute.  The approach looks very sensible to me.

Thanks,
Jonathan

  parent reply	other threads:[~2012-05-22 23:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 20:19 [PATCH/RFC] rebase -p: do not redo the merge, but cherry-pick first-parent changes Johannes Sixt
2012-05-22 18:23 ` Junio C Hamano
2012-05-22 19:30   ` Johannes Sixt
2012-05-22 23:38 ` Jonathan Nieder [this message]
2012-05-23 15:37 ` Martin von Zweigbergk
2012-05-23 18:53   ` Junio C Hamano
2012-05-23 20:41     ` Martin von Zweigbergk
2012-05-24 17:31       ` Junio C Hamano
2012-05-24 17:47         ` Martin von Zweigbergk
2012-05-24 20:09           ` Junio C Hamano
2012-05-24 20:32           ` Johannes Sixt
2012-05-24 21:34             ` Junio C Hamano
2012-05-25 15:58               ` Johannes Sixt
2012-05-25 16:58                 ` Junio C Hamano
2012-05-25 20:03                   ` Johannes Sixt
2012-05-23 18:59   ` Johannes Sixt

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=20120522233821.GA31667@burratino \
    --to=jrnieder@gmail.com \
    --cc=andrew.kw.w@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=stephen@exigencecorp.com \
    /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;
as well as URLs for NNTP newsgroup(s).