Skip to content

Commit

Permalink
rebase: finish_rebase() in noop rebase
Browse files Browse the repository at this point in the history
In the following case

  $ git rebase master
  Current branch autostash-fix is up to date.

the autostash is not applied automatically, because this codepath
forgets to call finish_rebase().  Fix this.  Also add a test to guard
against regressions.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramkumar Ramachandra authored and Junio C Hamano committed Jun 13, 2013
1 parent af2f0eb commit 96e2b99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions git-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ then
# Lazily switch to the target branch if needed...
test -z "$switch_to" || git checkout "$switch_to" --
say "$(eval_gettext "Current branch \$branch_name is up to date.")"
finish_rebase
exit 0
else
say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
Expand Down
11 changes: 11 additions & 0 deletions t/t3420-rebase-autostash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ test_expect_success "rebase: fast-forward rebase" '
git checkout feature-branch
'

test_expect_success "rebase: noop rebase" '
test_config rebase.autostash true &&
git reset --hard &&
git checkout -b same-feature-branch feature-branch &&
test_when_finished git branch -D same-feature-branch &&
echo dirty >>file1 &&
git rebase feature-branch &&
grep dirty file1 &&
git checkout feature-branch
'

testrebase "" .git/rebase-apply
testrebase " --merge" .git/rebase-merge
testrebase " --interactive" .git/rebase-merge
Expand Down

0 comments on commit 96e2b99

Please sign in to comment.