From 85a997604006248ac7e811627f830de7dcb0236c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 12:21:51 -1000 Subject: Test a link target that climbs above the root Only an absolute target was tested, so ignoring a failed normalisation passed, and the mutation run left that change alive. --- tests/t0104-tree.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 5df20b2..4cb1c06 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -207,7 +207,8 @@ test_expect_success 'a submodule path is answered with the submodule' ' ' # A link target inside the tree becomes a link, while an absolute one names a -# file on whatever machine checks the tree out, not a path in the tree. +# file on whatever machine checks the tree out, not a path in the tree, and +# so does one that climbs above the root. test_expect_success 'only a link target inside the tree is linked' ' test_create_repo repos/links && ( @@ -216,15 +217,18 @@ test_expect_success 'only a link target inside the tree is linked' ' git add target.txt && rel=$(printf target.txt | git hash-object -w --stdin) && abs=$(printf /etc/passwd | git hash-object -w --stdin) && + up=$(printf ../outside | git hash-object -w --stdin) && git update-index --add --cacheinfo 120000,$rel,rel && git update-index --add --cacheinfo 120000,$abs,abs && + git update-index --add --cacheinfo 120000,$up,up && git commit -m links ) && cgitrc_repo linksrc links && cgit_ok linksrc "url=links/tree/" >tmp && grep " -> target.txt" tmp && grep " -> /etc/passwd" tmp && - test_grep ! "href=./links/tree/etc/passwd" tmp + test_grep ! "href=./links/tree/etc/passwd" tmp && + test_grep " -> \.\./outside" tmp ' # Blame takes a regular file alone, so a symlink is not offered it. The -- cgit 2.12.1