From c7adc9ddba5ab29d53f7eb54e33a62807fa3ae0c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:18 -1000 Subject: End a long directory chain on its last link Past fifteen single directories the row stopped after writing the next separator, which left it ending in a dangling " / ". --- tests/t0104-tree.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index a2ec3c2..e92b2a2 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -108,4 +108,31 @@ test_expect_success 'only a link target inside the tree is linked' ' ! grep "href=./links/tree/etc/passwd" tmp ' +# A row follows a chain of single directories for a set number of levels and +# stops on the last one it links, with no separator left hanging after it. +test_expect_success 'a long directory chain ends on a link' ' + test_create_repo repos/deep && + ( + cd repos/deep && + p=d1 && + for i in $(test_seq 2 17) + do + p=$p/d$i || return 1 + done && + mkdir -p $p && + echo deep >$p/file && + git add . && + git commit -m deep + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=deep" && + echo "repo.path=$PWD/repos/deep/.git" + } >deeprc && + CGIT_CONFIG="$PWD/deeprc" QUERY_STRING="url=deep/tree/" cgit >tmp && + grep ">d15" tmp && + ! grep " / " tmp +' + test_done -- cgit