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/cgit.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source/cgit.c') diff --git a/source/cgit.c b/source/cgit.c index 2ef4cf1..8a3d8c1 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -1098,9 +1098,20 @@ static void prepare_repo_env(int *nongit, int *err) setup_git_directory_gently(the_repository, nongit); *err = errno; // Notes come out of the object store, which a repository that failed - // to open has none of. - if (!*nongit) - load_display_notes(NULL); + // to open has none of, and git dies loading a notes ref that names + // no tree, so such a ref is passed over. + if (!*nongit) { + struct display_notes_opt opt; + char *ref = default_notes_ref(the_repository); + + // The notes are always set up, since the commit and log pages + // ask for them, only with no ref when the default names no tree. + init_display_notes(&opt); + opt.use_default_notes = cgit_notes_ref_usable(ref); + load_display_notes(&opt); + release_display_notes(&opt); + free(ref); + } } /* -- cgit