From dbed2ecdf824d154f7d69a624013a02e6e0966be Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 12:24:02 +0700 Subject: ui-shared: don't list branches when there is no repository print_header() fills the branch switcher from the main ref store whenever ctx.repo is set. For a request which prints a page before prepare_repo_cmd() has cleared ctx.repo -- an unknown page name for a repository whose repo.path is broken, for instance -- the ref store has never been initialized, and get_main_ref_store() aborts after the response has already begun: BUG: refs.c:2301: reference backend is unknown get_main_ref_store print_header at ui-shared.c:1057 cgit_print_error_page(fmt="Invalid request") Add cgit_have_repository() to say whether the repository for this request was opened, and skip the switcher when it was not. Signed-off-by: Saya Andy --- ui-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 9f7625c..a6a828d 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1042,7 +1042,7 @@ static void print_header(void) cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); html(" : "); cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); - if (ctx.env.authenticated) { + if (ctx.env.authenticated && cgit_have_repository()) { html(""); html("
\n"); cgit_add_hidden_formfields(0, 1, ctx.qry.page); -- cgit v1.3.1+13