Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Open the empty page's clone table on its first url
The page guessed from the two settings cgit_add_clone_urls reads, so a clone-url that expanded to nothing, or an empty one turning the global off, still drew a Clone heading over no rows. The summary already waits for a first url, and both now draw the heading the same way.
Diffstat (limited to '')
-rwxr-xr-xtests/t0102-summary.sh29
1 file changed, 29 insertions, 0 deletions
diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh
index e95f270..7df18e4 100755
--- a/tests/t0102-summary.sh
+++ b/tests/t0102-summary.sh
@@ -51,6 +51,35 @@ test_expect_success 'an scp clone url row links to the http url' '
! grep "vcs-git. href=.git@" tmp
'
+# A repository can turn the global clone-url off with an empty one of its own.
+# Neither its summary nor the page an empty repository gets then draws a Clone
+# heading over no rows.
+test_expect_success 'an empty clone url draws no clone heading' '
+ git init -q --bare repos/empty.git &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "clone-url=https://example.org/\$CGIT_REPO_URL" &&
+ echo "repo.url=foo" &&
+ echo "repo.path=$PWD/repos/foo/.git" &&
+ echo "repo.clone-url=" &&
+ echo "repo.url=empty" &&
+ echo "repo.path=$PWD/repos/empty.git" &&
+ echo "repo.clone-url=" &&
+ echo "repo.url=cloned" &&
+ echo "repo.path=$PWD/repos/empty.git"
+ } >emptyrc &&
+ CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=foo" cgit >tmp &&
+ grep "commit 1" tmp &&
+ ! grep "Clone</th>" tmp &&
+ CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=empty" cgit >tmp &&
+ grep "Repository seems to be empty" tmp &&
+ ! grep "Clone</th>" tmp &&
+ CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=cloned" cgit >tmp &&
+ grep "Clone</th>" tmp &&
+ grep "https://example.org/cloned</a>" tmp
+'
+
# Prints how many columns each row of the page's list table spans, one row to
# a line, counting a cell without a colspan as one.
row_widths() {