summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-08-23 09:55:41 +0100
committerJunio C Hamano <gitster@pobox.com>2007-08-23 02:34:19 -0700
commit1d25c8cf82eead72e11287d574ef72d3ebec0db1 (patch)
treee25c7e019c227f783bc99d4d31a9270cca6d4395 /git-rebase--interactive.sh
parent191131e538dd4188dbada7ce871f80af80556292 (diff)
downloadgit-1d25c8cf82eead72e11287d574ef72d3ebec0db1.tar.gz
rebase -i: fix squashing corner case
When squashing, rebase -i did not prevent fast forwards. This could happen when picking some other commit than the first one, and then squashing the first commit. So do not allow fast forwards when squashing. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bdec462609..ec798a16e9 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -96,13 +96,14 @@ die_abort () {
}
pick_one () {
- case "$1" in -n) sha1=$2 ;; *) sha1=$1 ;; esac
+ no_ff=
+ case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
test -d "$REWRITTEN" &&
pick_one_preserving_merges "$@" && return
parent_sha1=$(git rev-parse --verify $sha1^ 2>/dev/null)
current_sha1=$(git rev-parse --verify HEAD)
- if test $current_sha1 = $parent_sha1; then
+ if test $no_ff$current_sha1 = $parent_sha1; then
output git reset --hard $sha1
test "a$1" = a-n && output git reset --soft $current_sha1
sha1=$(git rev-parse --short $sha1)