rebase --skip: correctly wrap-up when skipping the last patch
When "rebase --skip" is used to skip the last patch in the series, the code to wrap up the rewrite by copying the notes from old to new commits and also by running the post-rewrite hook was bypassed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 22, 2010 at 16:50 UTC
ef88ad238779c4eadba9f179146fe213f047b89f
2 files changed
+17
-8
git-am.sh
-7
@@ -554,13 +554,6 @@ then
554
resume=
555
fi
556
557
-if test "$this" -gt "$last"
558
-then
559
- say Nothing to do.
560
- rm -fr "$dotest"
561
- exit
562
-fi
563
-
557
while test "$this" -le "$last"
558
do
559
msgnum=`printf "%0${prec}d" $this`
t/t5407-post-rewrite-hook.sh
+17
-1
@@ -10,7 +10,11 @@ test_expect_success 'setup' '
10
test_commit A foo A &&
11
test_commit B foo B &&
12
test_commit C foo C &&
13
- test_commit D foo D
13
+ test_commit D foo D &&
14
+ git checkout A^0 &&
15
+ test_commit E bar E &&
16
+ test_commit F foo F &&
17
+ git checkout master
18
'
19
20
mkdir .git/hooks
@@ -79,6 +83,18 @@ EOF
83
verify_hook_input
84
'
85
86
+test_expect_success 'git rebase --skip the last one' '
87
+ git reset --hard F &&
88
+ clear_hook_input &&
89
+ test_must_fail git rebase --onto D A &&
90
+ git rebase --skip &&
91
+ echo rebase >expected.args &&
92
+ cat >expected.data <<EOF &&
93
+$(git rev-parse E) $(git rev-parse HEAD)
94
+EOF
95
+ verify_hook_input
96
+'
97
+
98
test_expect_success 'git rebase -m' '
99
git reset --hard D &&
100
clear_hook_input &&