Skip to content

Commit

Permalink
rebase --skip: correctly wrap-up when skipping the last patch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gitster committed Dec 23, 2010
1 parent 77e5726 commit ef88ad2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
7 changes: 0 additions & 7 deletions git-am.sh
Expand Up @@ -554,13 +554,6 @@ then
resume= resume=
fi fi


if test "$this" -gt "$last"
then
say Nothing to do.
rm -fr "$dotest"
exit
fi

while test "$this" -le "$last" while test "$this" -le "$last"
do do
msgnum=`printf "%0${prec}d" $this` msgnum=`printf "%0${prec}d" $this`
Expand Down
18 changes: 17 additions & 1 deletion t/t5407-post-rewrite-hook.sh
Expand Up @@ -10,7 +10,11 @@ test_expect_success 'setup' '
test_commit A foo A && test_commit A foo A &&
test_commit B foo B && test_commit B foo B &&
test_commit C foo C && 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 mkdir .git/hooks
Expand Down Expand Up @@ -79,6 +83,18 @@ EOF
verify_hook_input 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' ' test_expect_success 'git rebase -m' '
git reset --hard D && git reset --hard D &&
clear_hook_input && clear_hook_input &&
Expand Down

0 comments on commit ef88ad2

Please sign in to comment.