Skip to content

Commit 8e75abf

Browse files
chriscoolgitster
authored andcommitted
rebase -i: use new --ff cherry-pick option
This simplifies rebase -i a little bit. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ab7e63e commit 8e75abf

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

git-rebase--interactive.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ do_with_author () {
222222
}
223223

224224
pick_one () {
225-
no_ff=
226-
case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac
225+
ff=--ff
226+
case "$1" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac
227227
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
228228
test -d "$REWRITTEN" &&
229229
pick_one_preserving_merges "$@" && return
@@ -232,16 +232,7 @@ pick_one () {
232232
output git cherry-pick "$@"
233233
return
234234
fi
235-
parent_sha1=$(git rev-parse --verify $sha1^) ||
236-
die "Could not get the parent of $sha1"
237-
current_sha1=$(git rev-parse --verify HEAD)
238-
if test -z "$no_ff" && test "$current_sha1" = "$parent_sha1"
239-
then
240-
output git reset --hard $sha1
241-
output warn Fast-forward to $(git rev-parse --short $sha1)
242-
else
243-
output git cherry-pick "$@"
244-
fi
235+
output git cherry-pick $ff "$@"
245236
}
246237

247238
pick_one_preserving_merges () {

0 commit comments

Comments
 (0)