Diff options
Diffstat (limited to 'tests/t0301-security.sh')
-rwxr-xr-xtests/t0301-security.sh5
1 file changed, 1 insertion, 4 deletions
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
'