[PATCH 4/4] rebase -i: use "git sequencer--helper --fast-forward"
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Aug 7, 2009, 20:40 UTC
- Message-ID
- <20090807204054.6280.39494.chriscool@tuxfamily.org>
when fast forwarding.
Note that in the first hunk of this patch, there was this line:
test "a$1" = a-n && output git reset --soft $current_sha1
but the test always failed.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> ---
The test "a$1" = a-n fails because if "$1" is set to "-n" then "$no_ff" is set to "t" above by:
case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac
and that means that:
test "$no_ff$current_sha1" = "$parent_sha1"
will fail.
But maybe I missed something. Otherwise I can send a patch for master to remove the dead code.
git-rebase--interactive.sh | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 0041994..7651fd6 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -154,11 +154,8 @@ pick_one () { die "Could not get the parent of $sha1" current_sha1=$(git rev-parse --verify HEAD) if test "$no_ff$current_sha1" = "$parent_sha1"; then - git sequencer--helper --reset-hard $sha1 \ + git sequencer--helper --fast-forward $sha1 \ "$GIT_REFLOG_ACTION" "$VERBOSE" - test "a$1" = a-n && output git reset --soft $current_sha1 - sha1=$(git rev-parse --short $sha1) - output warn Fast forward to $sha1 else output git cherry-pick "$@" fi @@ -238,10 +235,8 @@ pick_one_preserving_merges () { done case $fast_forward in t) - output warn "Fast forward to $sha1" - git sequencer--helper --reset-hard $sha1 \ - "$GIT_REFLOG_ACTION" "$VERBOSE" || - die "Cannot fast forward to $sha1" + git sequencer--helper --fast-forward $sha1 \ + "$GIT_REFLOG_ACTION" "$VERBOSE" || exit ;; f) first_parent=$(expr "$new_parents" : ' \([^ ]*\)')
-- 1.6.4.209.g16b77