From a8d6dfa1038b8878dd7f5b97b135d4d85a234c58 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 15 Oct 2026 19:26:09 -1000 Subject: Pass over a notes ref that names no tree A pusher can point refs/notes/commits or a signature notes ref at any object, and git dies loading one that is no tree, which ended every page of the repository, the dumb transport included. --- source/shared.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/shared.c') diff --git a/source/shared.c b/source/shared.c index 0bd9fe3..a20773b 100644 --- a/source/shared.c +++ b/source/shared.c @@ -756,3 +756,12 @@ int cgit_readme_is_tracked(const char *readme) return colon && colon[1]; } + +int cgit_notes_ref_usable(const char *notes_ref) +{ + struct object_id oid; + + if (repo_get_oid_treeish(the_repository, notes_ref, &oid)) + return 0; + return !!parse_tree_indirect(&oid); +} -- cgit 2.12.1