diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-11-02 09:46:57 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-11-03 00:37:06 +0100 |
commit | c603138e3d5bae3991fcf2ba98f09b0ea3beb056 (patch) | |
tree | 7458e9e5ed4e0bfabca44d4cc900a66c3d7012ba /t | |
parent | t: convert tests to not access reflog via the filesystem (diff) | |
download | git-c603138e3d5bae3991fcf2ba98f09b0ea3beb056.tar.xz git-c603138e3d5bae3991fcf2ba98f09b0ea3beb056.zip |
t1450: convert tests to remove worktrees via git-worktree(1)
Some of our tests in t1450 create worktrees and then corrupt them.
As it is impossible to delete such worktrees via a normal call to `git
worktree remove`, we instead opt to remove them manually by calling
rm(1) instead.
This is ultimately unnecessary though as we can use the `-f` switch to
remove the worktree. Let's convert the tests to do so such that we don't
have to reach into internal implementation details of worktrees.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t1450-fsck.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index a3c97b9c7f..a6af550867 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -141,7 +141,7 @@ test_expect_success 'HEAD link pointing at a funny place' ' test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' test_when_finished "git update-ref HEAD $orig_head" && - test_when_finished "rm -rf .git/worktrees wt" && + test_when_finished "git worktree remove -f wt" && git worktree add wt && echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery @@ -150,7 +150,7 @@ test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' ' test_expect_success 'other worktree HEAD link pointing at a funny object' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && echo $ZERO_OID >.git/worktrees/other/HEAD && test_must_fail git fsck 2>out && @@ -158,7 +158,7 @@ test_expect_success 'other worktree HEAD link pointing at a funny object' ' ' test_expect_success 'other worktree HEAD link pointing at missing object' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && object_id=$(echo "Contents missing from repo" | git hash-object --stdin) && test-tool -C other ref-store main update-ref msg HEAD $object_id "" REF_NO_DEREF,REF_SKIP_OID_VERIFICATION && @@ -167,7 +167,7 @@ test_expect_success 'other worktree HEAD link pointing at missing object' ' ' test_expect_success 'other worktree HEAD link pointing at a funny place' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && git -C other symbolic-ref HEAD refs/funny/place && test_must_fail git fsck 2>out && |