rebase -i: use new --ff cherry-pick option

This simplifies rebase -i a little bit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder 2010-03-06 21:34:46 +01:00 committed by Junio C Hamano
parent ab7e63e85f
commit 8e75abfd8d

View File

@ -222,8 +222,8 @@ do_with_author () {
} }
pick_one () { pick_one () {
no_ff= ff=--ff
case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac case "$1" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1" output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
test -d "$REWRITTEN" && test -d "$REWRITTEN" &&
pick_one_preserving_merges "$@" && return pick_one_preserving_merges "$@" && return
@ -232,16 +232,7 @@ pick_one () {
output git cherry-pick "$@" output git cherry-pick "$@"
return return
fi fi
parent_sha1=$(git rev-parse --verify $sha1^) || output git cherry-pick $ff "$@"
die "Could not get the parent of $sha1"
current_sha1=$(git rev-parse --verify HEAD)
if test -z "$no_ff" && test "$current_sha1" = "$parent_sha1"
then
output git reset --hard $sha1
output warn Fast-forward to $(git rev-parse --short $sha1)
else
output git cherry-pick "$@"
fi
} }
pick_one_preserving_merges () { pick_one_preserving_merges () {