From 180ecdad0c0d9d2587c70ac893e881f7217a49e8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 17:21:33 -1000 Subject: Answer a submodule path with the submodule The tree page read the gitlink's commit as a blob, which outside the repository is a bad object id and inside it is the commit's raw text. --- tests/t0104-tree.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index ca29bdc..35b1948 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -169,6 +169,15 @@ test_expect_success 'a file row still offers blame' ' grep ">blame" tmp ' +# A submodule's commit lives in another repository, so its path points there +# the way its row in the listing does. +test_expect_success 'a submodule path is answered with the submodule' ' + sub=$(git -C repos/submodules rev-parse HEAD~1) && + cgit_rc submodrc "url=submodules/tree/vendor/sub" >tmp && + grep "^Status: 404" tmp && + grep "
This path is a submodule: sub @ " tmp +' + # 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. test_expect_success 'only a link target inside the tree is linked' ' -- cgit 2.12.1