diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Point clone rows at a url a browser can follow
Diffstat (limited to '')
-rwxr-xr-xtests/t0102-summary.sh21
1 file changed, 21 insertions, 0 deletions
diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh
index 79f2b11..5ce1fab 100755
--- a/tests/t0102-summary.sh
+++ b/tests/t0102-summary.sh
@@ -32,4 +32,25 @@ test_expect_success 'clone-url expanded correctly' '
grep "git://example.org/bar.git" tmp
'
+# A clone url is shown as written, but a browser cannot follow the ssh, scp
+# or git forms, so those rows link to the first http url in the list, or to
+# the repository's own page when the list has none.
+test_expect_success 'a git clone url row falls back to the page url' '
+ grep "clone-url.><a rel=.vcs-git. title=.bar Git repository. href=./bar/.>git://example.org/bar.git</a>" tmp
+'
+
+test_expect_success 'an scp clone url row links to the http url' '
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "repo.url=foo" &&
+ echo "repo.path=$PWD/repos/foo/.git" &&
+ echo "repo.clone-url=git@example.org:foo https://example.org/foo"
+ } >clonerc &&
+ CGIT_CONFIG="$PWD/clonerc" QUERY_STRING="url=foo" cgit >tmp &&
+ grep "title=.foo Git repository. href=.https://example.org/foo.>git@example.org:foo</a>" tmp &&
+ grep "vcs-git. href=.https://example.org/foo." tmp &&
+ ! grep "vcs-git. href=.git@" tmp
+'
+
test_done