From 1695c8cd368efcccbfaa78d7331c9335b6509533 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 17:37:19 -1000 Subject: Move the tree grouping test to the tree tests Grouping folders first is tree page behaviour rather than a security fix, so it joins the tree tests on a repository of its own. --- tests/t0104-tree.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/t0104-tree.sh') diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index f17dd34..a42b247 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -453,4 +453,22 @@ test_expect_success 'a NUL past the first 8000 bytes still gets a blame link' ' test_grep ! ">blame" tmp ' + +# Grouping directories ahead of files is behaviour this fork adds, so nothing +# upstream covers it. The directory sorts after the file by name, so only the +# grouping can put it first. +test_expect_success 'tree groups directories before files' ' + test_create_repo repos/grouped && + mkdir repos/grouped/zsub && + test_commit -C repos/grouped --no-tag inner zsub/inner && + test_commit -C repos/grouped --no-tag top afile && + cgitrc_repo groupedrc grouped enable-tree-group-dirs=1 && + cgit_ok groupedrc "url=grouped/tree/" >tmp && + dirline=$(grep -n "tree/zsub" tmp | head -n 1 | cut -d: -f1) && + fileline=$(grep -n "tree/afile" tmp | head -n 1 | cut -d: -f1) && + test -n "$dirline" && + test -n "$fileline" && + test "$dirline" -lt "$fileline" +' + test_done -- cgit 2.12.1