]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rebase --skip: correctly wrap-up when skipping the last patch
authorJunio C Hamano <gitster@pobox.com>
Thu, 23 Dec 2010 00:50:28 +0000 (16:50 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Dec 2010 00:50:28 +0000 (16:50 -0800)
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>
git-am.sh
t/t5407-post-rewrite-hook.sh

index de116a29ef091a23f60603a28f1260ba60f054ac..69474e5da29c1bb121ae69432c06b63095b5bee6 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -554,13 +554,6 @@ then
        resume=
 fi
 
-if test "$this" -gt "$last"
-then
-       say Nothing to do.
-       rm -fr "$dotest"
-       exit
-fi
-
 while test "$this" -le "$last"
 do
        msgnum=`printf "%0${prec}d" $this`
index 552da65a61e8f78d40f8e19cfc5b73696ebcf283..baa670cea5d8a9d8b4b4578de69917fe76f71d46 100755 (executable)
@@ -10,7 +10,11 @@ test_expect_success 'setup' '
        test_commit A foo A &&
        test_commit B foo B &&
        test_commit C foo C &&
-       test_commit D foo D
+       test_commit D foo D &&
+       git checkout A^0 &&
+       test_commit E bar E &&
+       test_commit F foo F &&
+       git checkout master
 '
 
 mkdir .git/hooks
@@ -79,6 +83,18 @@ EOF
        verify_hook_input
 '
 
+test_expect_success 'git rebase --skip the last one' '
+       git reset --hard F &&
+       clear_hook_input &&
+       test_must_fail git rebase --onto D A &&
+       git rebase --skip &&
+       echo rebase >expected.args &&
+       cat >expected.data <<EOF &&
+$(git rev-parse E) $(git rev-parse HEAD)
+EOF
+       verify_hook_input
+'
+
 test_expect_success 'git rebase -m' '
        git reset --hard D &&
        clear_hook_input &&