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 '')
-rw-r--r--source/shared.c9
1 file changed, 9 insertions, 0 deletions
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);
+}