@matheusbsbs / matheus-bagliano / commits / 8e75abfd8d
Fork 0

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>

Christian Couder committed Mar 6, 2010 at 21:34 UTC 8e75abfd8dc6649d800b8877304eaa0fd404c10f
1 file changed +3 -12
git-rebase--interactive.sh
+3 -12
@@ -222,8 +222,8 @@ do_with_author () {
222 }
223
224 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
227 output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
228 test -d "$REWRITTEN" &&
229 pick_one_preserving_merges "$@" && return
@@ -232,16 +232,7 @@ pick_one () {
232 output git cherry-pick "$@"
233 return
234 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 "$@"
236 }
237
238 pick_one_preserving_merges () {