Merge branch 'rr/rebase-autostash'
* rr/rebase-autostash: rebase: finish_rebase() in noop rebase rebase: finish_rebase() in fast-forward rebase rebase: guard against missing files in read_basic_state()
This commit is contained in:
@ -84,6 +84,8 @@ keep_empty=
|
|||||||
test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t
|
test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t
|
||||||
|
|
||||||
read_basic_state () {
|
read_basic_state () {
|
||||||
|
test -f "$state_dir/head-name" &&
|
||||||
|
test -f "$state_dir/onto" &&
|
||||||
head_name=$(cat "$state_dir"/head-name) &&
|
head_name=$(cat "$state_dir"/head-name) &&
|
||||||
onto=$(cat "$state_dir"/onto) &&
|
onto=$(cat "$state_dir"/onto) &&
|
||||||
# We always write to orig-head, but interactive rebase used to write to
|
# We always write to orig-head, but interactive rebase used to write to
|
||||||
@ -545,6 +547,7 @@ then
|
|||||||
# Lazily switch to the target branch if needed...
|
# Lazily switch to the target branch if needed...
|
||||||
test -z "$switch_to" || git checkout "$switch_to" --
|
test -z "$switch_to" || git checkout "$switch_to" --
|
||||||
say "$(eval_gettext "Current branch \$branch_name is up to date.")"
|
say "$(eval_gettext "Current branch \$branch_name is up to date.")"
|
||||||
|
finish_rebase
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
|
say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
|
||||||
@ -577,6 +580,7 @@ if test "$mb" = "$orig_head"
|
|||||||
then
|
then
|
||||||
say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
|
say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
|
||||||
move_to_original_branch
|
move_to_original_branch
|
||||||
|
finish_rebase
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -141,6 +141,28 @@ testrebase() {
|
|||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_expect_success "rebase: fast-forward rebase" '
|
||||||
|
test_config rebase.autostash true &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout -b behind-feature-branch feature-branch~1 &&
|
||||||
|
test_when_finished git branch -D behind-feature-branch &&
|
||||||
|
echo dirty >>file1 &&
|
||||||
|
git rebase feature-branch &&
|
||||||
|
grep dirty file1 &&
|
||||||
|
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 "" .git/rebase-apply
|
||||||
testrebase " --merge" .git/rebase-merge
|
testrebase " --merge" .git/rebase-merge
|
||||||
testrebase " --interactive" .git/rebase-merge
|
testrebase " --interactive" .git/rebase-merge
|
||||||
|
Reference in New Issue
Block a user