Skip to content

Commit

Permalink
git-rebase--interactive.sh: Make 3-way merge strategies work for -p.
Browse files Browse the repository at this point in the history
git-rebase--interactive.sh used to pass all parents of a merge commit to
git-merge, which means that we have at least 3 heads to merge: HEAD,
first parent and second parent. So 3-way merge strategies like recursive
wouldn't work.

Fortunately, we have checked out the first parent right before the merge
anyway, so that is HEAD. Therefore we can drop simply it from the list
of parents, making 3-way strategies work for merge commits with only
two parents.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Björn Steinbrink authored and Junio C Hamano committed Oct 31, 2007
1 parent 2a9c53e commit f91333d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ pick_one_preserving_merges () {
eval "$author_script"
msg="$(git cat-file commit $sha1 | \
sed -e '1,/^$/d' -e "s/[\"\\]/\\\\&/g")"
# No point in merging the first parent, that's HEAD
new_parents=${new_parents# $first_parent}
# NEEDSWORK: give rerere a chance
if ! output git merge $STRATEGY -m "$msg" $new_parents
then
Expand Down

0 comments on commit f91333d

Please sign in to comment.