From 804b5b6172f1f8cda1c118c30cc257299bda8ee6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 2 Aug 2026 09:47:00 -1000 Subject: Give empty repositories their own page --- source/cgit.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'source/cgit.c') diff --git a/source/cgit.c b/source/cgit.c index 412d5f3..1ab77a4 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -16,6 +16,7 @@ #include "ui-shared.h" #include "ui-stats.h" #include "ui-blob.h" +#include "ui-empty.h" #include "ui-summary.h" #include "scan-tree.h" @@ -603,17 +604,6 @@ static void choose_readme(struct cgit_repo *repo) string_list_append(&repo->readme, filename)->util = ref; } -static void print_no_repo_clone_urls(const char *url) -{ - html(""); - html_txt(url); - html("\n"); -} - static void prepare_repo_env(int *nongit) { /* The path to the git repository. */ @@ -656,16 +646,15 @@ static int prepare_repo_cmd(int nongit) } if (!ctx.qry.head) { + ctx.empty_repo = 1; + // Before the document starts, since the carries + // and those clone urls expand macros such + // as $CGIT_REPO_URL out of this environment. + cgit_prepare_repo_env(ctx.repo); cgit_print_http_headers(); cgit_print_docstart(); cgit_print_pageheader(); - cgit_print_error("Repository seems to be empty"); - if (!strcmp(ctx.qry.page, "summary")) { - html("\n"); - cgit_prepare_repo_env(ctx.repo); - cgit_add_clone_urls(print_no_repo_clone_urls); - html("
 
Clone
\n"); - } + cgit_print_empty_repo(); cgit_print_docend(); return 1; } -- cgit v2.8.0