From 32cb4f35c92ba2602b5e65d05239158c5e32f56b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 18:07:09 -1000 Subject: List scanned repositories in path order readdir hands entries back in whatever order the filesystem keeps them, so proj111 could come before proj105 and a section could start twice. section-sort is off by default to keep the order written in cgitrc, and a scan has none to keep. --- tests/t0101-index.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index 2e49ed8..9b02a18 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -66,4 +66,31 @@ test_expect_success 'the index sorts by a column on request' ' done ' +# A scan has no cgitrc order for the index to keep, so it lists what it finds +# by path whatever order the directory hands back, comparing names the way +# case-sensitive-sort tells the index to. +test_expect_success 'a scan lists repositories in path order' ' + for name in proj9 Proj3 proj7 proj1 Proj5 proj8 proj2 proj6 proj4 + do + git init -q --bare "sorted/$name.git" || return 1 + done && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "scan-path=$PWD/sorted" + } >sortrc && + { + echo "case-sensitive-sort=0" && + cat sortrc + } >foldrc && + cgit_rc sortrc "url=" >tmp && + sed -n "s/.*>\([Pp]roj[0-9]\)\.git<\/a>.*/\1/p" tmp >order && + printf "%s\n" Proj3 Proj5 proj1 proj2 proj4 proj6 proj7 proj8 proj9 >expect && + test_cmp expect order && + cgit_rc foldrc "url=" >tmp && + sed -n "s/.*>\([Pp]roj[0-9]\)\.git<\/a>.*/\1/p" tmp >order && + printf "%s\n" proj1 proj2 Proj3 proj4 Proj5 proj6 proj7 proj8 proj9 >expect && + test_cmp expect order +' + test_done -- cgit 2.12.1