Message ID | 87d7e9bf2d4537ddbdec8c8fa67190e81a426312.1631094563.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | rebase: dereference tags | expand |
On Wed, Sep 08 2021, Phillip Wood via GitGitGadget wrote: > 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. > [...] > +# 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 > +} I reflexively thought "use test_cmp here!", but in this case that's pointless as any difference is noted by test_cmp_rev, we're really seeing what HEAD is checked out to here. I see we use the same pattern in various other tests...
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh index 624d2ee3fa4..72cf391156d 100755 --- a/t/t3407-rebase-abort.sh +++ b/t/t3407-rebase-abort.sh @@ -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 @@ -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" ' @@ -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" ' @@ -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" '