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/ui-snapshot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/ui-snapshot.c') diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 32d40f8..6a059a0 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -311,7 +311,12 @@ const struct object_id *cgit_snapshot_get_sig(const char *ref, const struct cgit // dropped, so plain tar is refs/notes/signatures/tar. strbuf_addf(¬es_ref, "refs/notes/signatures/%s", f->suffix + 1); - init_notes(tree, notes_ref.buf, combine_notes_ignore, 0); + // A ref that names no tree is passed over, since git would die + // loading it, and a signature it cannot hold is just absent. + if (cgit_notes_ref_usable(notes_ref.buf)) + init_notes(tree, notes_ref.buf, combine_notes_ignore, 0); + else + init_notes(tree, notes_ref.buf, combine_notes_ignore, NOTES_INIT_EMPTY); strbuf_release(¬es_ref); } -- cgit