Skip to content

Commit af2f0eb

Browse files
artagnongitster
authored andcommitted
rebase: finish_rebase() in fast-forward rebase
In the following case $ git rebase master Fast-forwarded autostash-fix to master. 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 dc8ca91 commit af2f0eb

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
@@ -579,6 +579,7 @@ if test "$mb" = "$orig_head"
579579
then
580580
say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
581581
move_to_original_branch
582+
finish_rebase
582583
exit 0
583584
fi
584585

t/t3420-rebase-autostash.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ testrebase() {
141141
'
142142
}
143143

144+
test_expect_success "rebase: fast-forward rebase" '
145+
test_config rebase.autostash true &&
146+
git reset --hard &&
147+
git checkout -b behind-feature-branch feature-branch~1 &&
148+
test_when_finished git branch -D behind-feature-branch &&
149+
echo dirty >>file1 &&
150+
git rebase feature-branch &&
151+
grep dirty file1 &&
152+
git checkout feature-branch
153+
'
154+
144155
testrebase "" .git/rebase-apply
145156
testrebase " --merge" .git/rebase-merge
146157
testrebase " --interactive" .git/rebase-merge

0 commit comments

Comments
 (0)