rebase: finish_rebase() in noop rebase
authorRamkumar Ramachandra <artagnon@gmail.com>
Thu, 13 Jun 2013 16:06:13 +0000 (21:36 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Jun 2013 22:31:06 +0000 (15:31 -0700)
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>
git-rebase.sh
t/t3420-rebase-autostash.sh
index 154d4be0a44bf1bd66a7d01921cc9f46cd9d91e2..2d5c2bd0fcf773367b892fbb993704e5f2089c64 100755 (executable)
@@ -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.")"
index 1bde00716046e5483b7121d31a455b41f82d8342..90eb26493cd309da34687dffc939166069cd88c6 100755 (executable)
@@ -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