From 8aa0cafbd30f1d2df149e32b22b581a5d86afdeb Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:11:56 -0700 Subject: Look up a request's commit in one place The diff page now names a revision that is no commit the way the request wrote it, as the other pages already did, rather than as the full id it resolved to. The helpers sit beside the error page in ui-shared.c, since shared.c prints nothing. --- source/ui-tree.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source/ui-tree.c') diff --git a/source/ui-tree.c b/source/ui-tree.c index 1c29e30..300207f 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -486,15 +486,9 @@ void cgit_print_tree(const char *rev, char *path) if (!rev) rev = ctx.qry.head; - if (repo_get_oid(the_repository, rev, &oid)) { - cgit_print_error_page(404, "Not Found", "Bad object id: %s", rev); + commit = cgit_get_commit(rev, &oid); + if (!commit) return; - } - commit = lookup_commit_reference(the_repository, &oid); - if (!commit || repo_parse_commit(the_repository, commit)) { - cgit_print_error_page(404, "Not Found", "Not a commit: %s", rev); - return; - } walk.rev = rev; -- cgit