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-snapshot.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'source/ui-snapshot.c') diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 2fa121f..333bce6 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -224,14 +224,8 @@ static void send_snapshot(const struct cgit_snapshot_format *format, const char { struct object_id oid; - if (repo_get_oid(the_repository, hex, &oid)) { - cgit_print_error_page(404, "Not Found", "Bad object id: %s", hex); + if (!cgit_get_commit(hex, &oid)) return; - } - if (!lookup_commit_reference(the_repository, &oid)) { - cgit_print_error_page(404, "Not Found", "Not a commit: %s", hex); - return; - } // A compressor that cannot run only shows up as a broken pipe once // the tar is under way, so it is looked for while a status can still // say so. -- cgit