summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 191131e)
raw | patch | inline | side by side (parent: 191131e)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 23 Aug 2007 08:55:41 +0000 (09:55 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 23 Aug 2007 09:34:19 +0000 (02:34 -0700) |
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>
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>
git-rebase--interactive.sh | patch | blob | history | |
t/t3404-rebase-interactive.sh | patch | blob | history |
index bdec4626090342141510600cf31fb0d796aea04d..ec798a16e98d7c503071d01fd79b3d156e77058c 100755 (executable)
}
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)
index 40d6799ed6243e353b38aa7c7149af1362b798b2..718c9c1fa31fa63fee65a7da857f0c9378af3c5c 100755 (executable)
test $one = $(git rev-parse HEAD~2)
'
+test_expect_success 'interrupted squash works as expected (case 2)' '
+ for n in one two three four
+ do
+ echo $n >> conflict &&
+ git add conflict &&
+ git commit -m $n
+ done &&
+ one=$(git rev-parse HEAD~3) &&
+ ! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
+ (echo one; echo four) > conflict &&
+ git add conflict &&
+ ! git rebase --continue &&
+ (echo one; echo two; echo four) > conflict &&
+ git add conflict &&
+ ! git rebase --continue &&
+ echo resolved > conflict &&
+ git add conflict &&
+ git rebase --continue &&
+ test $one = $(git rev-parse HEAD~2)
+'
+
test_expect_success 'ignore patch if in upstream' '
HEAD=$(git rev-parse HEAD) &&
git checkout -b has-cherry-picked HEAD^ &&