From b03c055330bfc06472c6e2a28bb2ea12ca6fb0a1 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -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. Such a ref now counts as absent. --- 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