diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
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.
Diffstat (limited to 'source/ui-snapshot.c')
-rw-r--r--source/ui-snapshot.c7
1 file changed, 6 insertions, 1 deletion
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(&notes_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(&notes_ref);
}