rebase: finish_rebase() in noop rebase

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>

Ramkumar Ramachandra committed Jun 13, 2013 at 21:36 UTC 96e2b99ed56c8433cc4aa03f32d2ef2a22748fc0
2 files changed +12
git-rebase.sh
+1
@@ -547,6 +547,7 @@ then
547 # Lazily switch to the target branch if needed...
548 test -z "$switch_to" || git checkout "$switch_to" --
549 say "$(eval_gettext "Current branch \$branch_name is up to date.")"
550 + finish_rebase
551 exit 0
552 else
553 say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
t/t3420-rebase-autostash.sh
+11
@@ -152,6 +152,17 @@ test_expect_success "rebase: fast-forward rebase" '
152 git checkout feature-branch
153 '
154
155 +test_expect_success "rebase: noop rebase" '
156 + test_config rebase.autostash true &&
157 + git reset --hard &&
158 + git checkout -b same-feature-branch feature-branch &&
159 + test_when_finished git branch -D same-feature-branch &&
160 + echo dirty >>file1 &&
161 + git rebase feature-branch &&
162 + grep dirty file1 &&
163 + git checkout feature-branch
164 +'
165 +
166 testrebase "" .git/rebase-apply
167 testrebase " --merge" .git/rebase-merge
168 testrebase " --interactive" .git/rebase-merge