t3407: rework rebase --quit tests

9512177b68 ("rebase: add --quit to cleanup rebase, leave everything
else untouched", 2016-11-12) seems to have copied the --abort tests
but added two separate tests for the two rebase backends rather than
adding a single test into the existing testrebase() function.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Phillip Wood 2021-09-13 15:19:18 +00:00 committed by Junio C Hamano
parent 1e14bc11ed
commit d045719ac8
1 changed files with 12 additions and 22 deletions

View File

@ -86,31 +86,21 @@ testrebase() {
test_must_fail git rebase --abort -v && test_must_fail git rebase --abort -v &&
git rebase --abort git rebase --abort
' '
}


testrebase " --apply" .git/rebase-apply test_expect_success "rebase$type --quit" '
testrebase " --merge" .git/rebase-merge test_when_finished "git symbolic-ref HEAD refs/heads/to-rebase" &&

test_expect_success 'rebase --apply --quit' '
# Clean up the state from the previous one # Clean up the state from the previous one
git reset --hard pre-rebase && git reset --hard pre-rebase &&
test_must_fail git rebase --apply main && test_must_fail git rebase$type main &&
test_path_is_dir .git/rebase-apply && test_path_is_dir $state_dir &&
head_before=$(git rev-parse HEAD) && head_before=$(git rev-parse HEAD) &&
git rebase --quit && git rebase --quit &&
test_cmp_rev HEAD $head_before && test_cmp_rev HEAD $head_before &&
test_path_is_missing .git/rebase-apply test_path_is_missing .git/rebase-apply
' '
}


test_expect_success 'rebase --merge --quit' ' testrebase " --apply" .git/rebase-apply
# Clean up the state from the previous one testrebase " --merge" .git/rebase-merge
git reset --hard pre-rebase &&
test_must_fail git rebase --merge main &&
test_path_is_dir .git/rebase-merge &&
head_before=$(git rev-parse HEAD) &&
git rebase --quit &&
test_cmp_rev HEAD $head_before &&
test_path_is_missing .git/rebase-merge
'


test_done test_done