Skip to content

Commit ef88ad2

Browse files
committed
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 <[email protected]>
1 parent 77e5726 commit ef88ad2

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

git-am.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,6 @@ then
554554
resume=
555555
fi
556556

557-
if test "$this" -gt "$last"
558-
then
559-
say Nothing to do.
560-
rm -fr "$dotest"
561-
exit
562-
fi
563-
564557
while test "$this" -le "$last"
565558
do
566559
msgnum=`printf "%0${prec}d" $this`

t/t5407-post-rewrite-hook.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ test_expect_success 'setup' '
1010
test_commit A foo A &&
1111
test_commit B foo B &&
1212
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
1418
'
1519

1620
mkdir .git/hooks
@@ -79,6 +83,18 @@ EOF
7983
verify_hook_input
8084
'
8185

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+
8298
test_expect_success 'git rebase -m' '
8399
git reset --hard D &&
84100
clear_hook_input &&

0 commit comments

Comments
 (0)