Diff options
Diffstat (limited to '')
-rwxr-xr-xtests/t0202-submodule-links.sh12
1 file changed, 3 insertions, 9 deletions
diff --git a/tests/t0202-submodule-links.sh b/tests/t0202-submodule-links.sh
index 6db164f..a5810a0 100755
--- a/tests/t0202-submodule-links.sh
+++ b/tests/t0202-submodule-links.sh
@@ -11,9 +11,9 @@ test_description='Check submodule links derived from .gitmodules'
test_expect_success 'set up a parent repo with submodules' '
mkrepo repos/subtarget 1 &&
mkrepo repos/subparent 1 &&
+ sub=$(git -C repos/subparent rev-parse HEAD) &&
(
cd repos/subparent &&
- sub=$(git rev-parse HEAD) &&
git update-index --add --cacheinfo 160000,$sub,local-ssh &&
git update-index --add --cacheinfo 160000,$sub,sibling &&
git update-index --add --cacheinfo 160000,$sub,forge-https &&
@@ -55,21 +55,18 @@ test_expect_success 'set up a parent repo with submodules' '
'
test_expect_success 'generate subparent/tree' '
- CGIT_CONFIG="$PWD/subrc" QUERY_STRING="url=subparent/tree/" cgit >tmp
+ cgit_rc subrc "url=subparent/tree/" >tmp
'
test_expect_success 'an ssh url served here links to the local repo' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=./subtarget/tree/?id=$sub.>local-ssh</a>" tmp
'
test_expect_success 'its hash links to the local commit page' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=./subtarget/commit/?id=$sub." tmp
'
test_expect_success 'a relative url resolves against this repository' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=./subtarget/tree/?id=$sub.>sibling</a>" tmp
'
@@ -78,18 +75,15 @@ test_expect_success 'a web url is linked as it is' '
'
test_expect_success 'a known forge hash links to its commit page' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=.https://github.com/example/project/commit/$sub." tmp
'
test_expect_success 'an ssh url to a known forge is rewritten' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=.https://github.com/example/other.>forge-ssh</a>" tmp &&
grep "href=.https://github.com/example/other/commit/$sub." tmp
'
test_expect_success 'a cgit host keeps its .git suffix in the commit link' '
- sub=$(git -C repos/subparent rev-parse HEAD~1) &&
grep "href=.https://git.kernel.org/pub/scm/git/git.git/commit/?id=$sub." tmp
'
@@ -99,7 +93,7 @@ test_expect_success 'an unresolvable url stays unlinked with a tooltip' '
test_expect_success 'the links stay off without the flag' '
sed "/enable-gitmodules-links/d" subrc >subrcoff &&
- CGIT_CONFIG="$PWD/subrcoff" QUERY_STRING="url=subparent/tree/" cgit >tmp &&
+ cgit_rc subrcoff "url=subparent/tree/" >tmp &&
! grep "subtarget/tree" tmp &&
grep "class=.ls-mod.>local-ssh</span>" tmp
'