Diff options
Diffstat (limited to 'tests/t0202-submodule-links.sh')
-rwxr-xr-xtests/t0202-submodule-links.sh8
1 file changed, 1 insertion, 7 deletions
diff --git a/tests/t0202-submodule-links.sh b/tests/t0202-submodule-links.sh
index 6db164f..2cbbba7 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 &&
@@ -59,17 +59,14 @@ test_expect_success 'generate subparent/tree' '
'
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
'