From c92c0fa877807f7c0dd7b27ed78fe1076d18d38f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:37:56 -0700 Subject: 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. --- tests/t0102-summary.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') 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" tmp && + CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=empty" cgit >tmp && + grep "Repository seems to be empty" tmp && + ! grep "Clone" tmp && + CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=cloned" cgit >tmp && + grep "Clone" tmp && + grep "https://example.org/cloned" 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() { -- cgit