Skip to content

Commit 96e2b99

Browse files
artagnongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af2f0eb commit 96e2b99

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

git-rebase.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ then
547547
# Lazily switch to the target branch if needed...
548548
test -z "$switch_to" || git checkout "$switch_to" --
549549
say "$(eval_gettext "Current branch \$branch_name is up to date.")"
550+
finish_rebase
550551
exit 0
551552
else
552553
say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"

t/t3420-rebase-autostash.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ test_expect_success "rebase: fast-forward rebase" '
152152
git checkout feature-branch
153153
'
154154

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+
155166
testrebase "" .git/rebase-apply
156167
testrebase " --merge" .git/rebase-merge
157168
testrebase " --interactive" .git/rebase-merge

0 commit comments

Comments
 (0)