From 239371168173da9a9556617fced1e053ac618a85 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 2 Nov 2023 09:46:49 +0100 Subject: t: convert tests to not access symrefs via the filesystem Some of our tests access symbolic references via the filesystem directly. While this works with the current files reference backend, it this will break once we have a second reference backend in our codebase. Refactor these tests to instead use git-symbolic-ref(1) or our `ref-store` test tool. The latter is required in some cases where safety checks of git-symbolic-ref(1) would otherwise reject writing a symbolic reference. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- t/t1450-fsck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t1450-fsck.sh') diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index f55b539b08..a3c97b9c7f 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -133,7 +133,7 @@ test_expect_success 'HEAD link pointing at a funny object' ' test_expect_success 'HEAD link pointing at a funny place' ' test_when_finished "git update-ref --no-deref HEAD $orig_head" && - echo "ref: refs/funny/place" >.git/HEAD && + test-tool ref-store main create-symref HEAD refs/funny/place && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && test_i18ngrep "HEAD points to something strange" out @@ -169,7 +169,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" && git worktree add other && - echo "ref: refs/funny/place" >.git/worktrees/other/HEAD && + git -C other symbolic-ref HEAD refs/funny/place && test_must_fail git fsck 2>out && test_i18ngrep "worktrees/other/HEAD points to something strange" out ' -- cgit v1.2.3