From e7eff4197d809a221586d9b28f08fb8ac40ebc8c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 19:26:58 -1000 Subject: Keep a space in a repository url in one clone url The shared repository "with space" listed git://example.org/with and space.git as two clone urls, and the head linked the first alone. The manual calls clone-url a list of templates, so the list is now split before each template is expanded. A clone-prefix was right already, as the url is joined to it after the split. --- tests/t0102-summary.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh index b31d476..632698c 100755 --- a/tests/t0102-summary.sh +++ b/tests/t0102-summary.sh @@ -69,6 +69,22 @@ test_expect_success 'clone-prefix gives a clone url per prefix' ' test_grep "clone-url.>git://b/foo" tmp ' +# The list is split into its templates before each is expanded, so a space in +# the repository url stays inside one clone url, in the rows and in the head +# alike. A clone-prefix has the url joined to it after the split. +test_expect_success 'a space in the repository url stays inside one clone url' ' + cgit_ok_url "with+space" >tmp && + test_grep "clone-url.>git://example.org/with space.git" tmp && + test $(grep -c "class=.clone-url." tmp) = 1 && + test_grep "" tmp && + test $(grep -c "tmp && + test_grep ">https://a/with space" tmp && + test_grep ">git://b/with space" tmp && + test $(grep -c "class=.clone-url." tmp) = 2 +' + # 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. -- cgit 2.12.1