From ca6d3fc9bc62e7a3c9ffef1fe4baf0dfe0716ee7 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:17:06 -0700 Subject: Work out each gitlink's target once Test bodies run in the main shell, so the target named in the fixture reaches every check that greps for it. --- tests/t0301-security.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tests/t0301-security.sh') diff --git a/tests/t0301-security.sh b/tests/t0301-security.sh index 45d472d..453d521 100755 --- a/tests/t0301-security.sh +++ b/tests/t0301-security.sh @@ -221,9 +221,9 @@ test_expect_success 'name-sorted branches are unaffected' ' # working. test_expect_success 'set up a submodule fixture with a hostile module-link' ' mkrepo repos/modlink 1 && + sub=$(git -C repos/modlink rev-parse HEAD) && ( cd repos/modlink && - sub=$(git rev-parse HEAD) && git update-index --add --cacheinfo 160000,$sub,submod && git commit -m gitlink ) && @@ -255,7 +255,6 @@ test_expect_success 'a well-formed module-link still takes name and sha1' ' echo "repo.url=modlink" && echo "repo.path=$PWD/repos/modlink/.git" } >modlinkokrc && - sub=$(git -C repos/modlink rev-parse HEAD~1) && CGIT_CONFIG="$PWD/modlinkokrc" QUERY_STRING="url=modlink/tree/" cgit >tmp && grep "href=./mod/submod/commit/?id=$sub." tmp ' @@ -268,7 +267,6 @@ test_expect_success 'a per-path module-link takes only the sha1' ' echo "repo.path=$PWD/repos/modlink/.git" && echo "repo.module-link.submod=https://example.com/s/?id=%s" } >modlinkpathrc && - sub=$(git -C repos/modlink rev-parse HEAD~1) && CGIT_CONFIG="$PWD/modlinkpathrc" QUERY_STRING="url=modlink/tree/" cgit >tmp && grep "href=.https://example.com/s/?id=$sub." tmp ' @@ -281,7 +279,6 @@ test_expect_success 'a doubled percent in a module-link renders as one' ' echo "repo.url=modlink" && echo "repo.path=$PWD/repos/modlink/.git" } >modlinkpctrc && - sub=$(git -C repos/modlink rev-parse HEAD~1) && CGIT_CONFIG="$PWD/modlinkpctrc" QUERY_STRING="url=modlink/tree/" cgit >tmp && grep "href=./m/submod/%/$sub." tmp ' -- cgit