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/ui-empty.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 source/ui-empty.c (limited to 'source/ui-empty.c') diff --git a/source/ui-empty.c b/source/ui-empty.c new file mode 100644 index 0000000..cb91fbc --- /dev/null +++ b/source/ui-empty.c @@ -0,0 +1,41 @@ +/* + * ui-empty.c: page shown for a repository that holds no commits + * + * Copyright (C) 2006-2014 cgit Development Team + * + * Licensed under GNU General Public License v2 + * (see LICENSE.txt for full license text) + */ + +#include "cgit.h" +#include "ui-empty.h" +#include "html.h" +#include "ui-shared.h" + +static void print_clone_url(const char *url) +{ + html(""); + html_txt(url); + html("\n"); +} + +/* + * The caller has already prepared the repo environment, which the clone urls + * need for macro expansion. + */ +void cgit_print_empty_repo(void) +{ + cgit_print_error("Repository seems to be empty"); + + if (!ctx.repo->clone_url && !ctx.cfg.clone_prefix) + return; + + html(""); + html("\n"); + cgit_add_clone_urls(print_clone_url); + html("
Clone
\n"); +} -- cgit v2.8.0