Skip to content

Commit

Permalink
rebase-i-p: fix 'no squashing merges' tripping up non-merges
Browse files Browse the repository at this point in the history
Also only check out the first parent if this commit if not a squash--if it is a
squash, we want to explicitly ignore the parent and leave the wc as is, as
cherry-pick will apply the squash on top of it.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stephen Haberman authored and Junio C Hamano committed Oct 16, 2008
1 parent bb64507 commit a4f25e3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,19 @@ pick_one_preserving_merges () {
die "Cannot fast forward to $sha1"
;;
f)
test "a$1" = a-n && die "Refusing to squash a merge: $sha1"

first_parent=$(expr "$new_parents" : ' \([^ ]*\)')
# detach HEAD to current parent
output git checkout $first_parent 2> /dev/null ||
die "Cannot move HEAD to $first_parent"

if [ "$1" != "-n" ]
then
# detach HEAD to current parent
output git checkout $first_parent 2> /dev/null ||
die "Cannot move HEAD to $first_parent"
fi

case "$new_parents" in
' '*' '*)
test "a$1" = a-n && die "Refusing to squash a merge: $sha1"

# redo merge
author_script=$(get_author_ident_from_commit $sha1)
eval "$author_script"
Expand Down

0 comments on commit a4f25e3

Please sign in to comment.