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. --- source/ui-tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/ui-tree.c') diff --git a/source/ui-tree.c b/source/ui-tree.c index 63b8984..f1b995a 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -470,6 +470,11 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base, strbuf_release(&fullpath); ls_head(); return READ_TREE_RECURSIVE; + } else if (S_ISGITLINK(mode)) { + cgit_print_submodule_page(fullpath.buf, oid_to_hex(oid)); + walk->state = WALK_ERROR_SHOWN; + strbuf_release(&fullpath); + return 0; } else { bool shown = print_object(oid, mode, fullpath.buf, pathname, walk->rev); @@ -524,6 +529,6 @@ void cgit_print_tree(const char *rev, char *path) } else if (walk.state == WALK_LOOKING) { cgit_print_error_page(404, "Not Found", "Path not found"); } - // WALK_ERROR_SHOWN is left alone, since the error page print_object - // put out is already complete. + // WALK_ERROR_SHOWN is left alone, since the error page the walk put + // out is already complete. } -- cgit 2.12.1