Skip to content

Commit

Permalink
t3407: strengthen rebase --abort tests
Browse files Browse the repository at this point in the history
The existing tests only check that HEAD points to the correct
commit after aborting, they do not check that the original branch
is checked out.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
phillipwood authored and gitster committed Sep 13, 2021
1 parent 0b7ae73 commit 1e14bc1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions t/t3407-rebase-abort.sh
Expand Up @@ -19,6 +19,13 @@ test_expect_success setup '
test_commit "merge should fail on this, too" a e pre-rebase
'

# Check that HEAD is equal to "pre-rebase" and the current branch is
# "to-rebase"
check_head() {
test_cmp_rev HEAD pre-rebase &&
test "$(git symbolic-ref HEAD)" = refs/heads/to-rebase
}

testrebase() {
type=$1
state_dir=$2
Expand All @@ -29,7 +36,7 @@ testrebase() {
test_must_fail git rebase$type main &&
test_path_is_dir "$state_dir" &&
git rebase --abort &&
test_cmp_rev to-rebase pre-rebase &&
check_head &&
test_path_is_missing "$state_dir"
'

Expand All @@ -41,7 +48,7 @@ testrebase() {
test_must_fail git rebase --skip &&
test_cmp_rev HEAD main &&
git rebase --abort &&
test_cmp_rev to-rebase pre-rebase &&
check_head &&
test_path_is_missing "$state_dir"
'

Expand All @@ -56,7 +63,7 @@ testrebase() {
test_must_fail git rebase --continue &&
test_cmp_rev ! HEAD main &&
git rebase --abort &&
test_cmp_rev to-rebase pre-rebase &&
check_head &&
test_path_is_missing "$state_dir"
'

Expand Down

0 comments on commit 1e14bc1

Please sign in to comment.