From 02db497e4167e9f0673afdf650726b220f06abed Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 12:36:25 -1000 Subject: Test plain on a symlink and a submodule entry --- tests/t0105-plain.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/t0105-plain.sh b/tests/t0105-plain.sh index 63ab661..5364a0e 100755 --- a/tests/t0105-plain.sh +++ b/tests/t0105-plain.sh @@ -73,6 +73,30 @@ test_expect_success 'a folder listing links its entries and its parent' ' test_grep "
  • b.txt
  • " tmp ' +# A symlink is answered with its target as text. A submodule's commit lives +# in another repository, so its entry names that commit rather than linking +# a path here. +test_expect_success 'plain serves a link target and lists a submodule' ' + mkrepo repos/plainmod 1 && + ( + cd repos/plainmod && + sub=$(git rev-parse HEAD) && + git update-index --add --cacheinfo 160000,$sub,sub && + link=$(printf file-1 | git hash-object -w --stdin) && + git update-index --add --cacheinfo 120000,$link,link && + git commit -m "link and submodule" + ) && + cgitrc_repo plainmodrc plainmod && + cgit_ok plainmodrc "url=plainmod/plain/link" >tmp && + strip_headers body && + printf file-1 >expect && + test_cmp expect body && + sub=$(git -C repos/plainmod rev-parse HEAD~1) && + cgit_ok plainmodrc "url=plainmod/plain/" >tmp && + test_grep "
  • sub @ " tmp && + test_grep ! "href=./plainmod/plain/sub" tmp +' + test_expect_success 'a blob whose bytes look binary is served as octet-stream' ' ( cd repos/foo && -- cgit 2.12.1