From d946c8cf11385f5766e827ae71b3fc798750a335 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Wed, 2 Apr 2025 21:00:51 +0200 Subject: Added default_index config parameter. Note: currently breaks repos that contain no readme --- ui-repolist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ui-repolist.c') diff --git a/ui-repolist.c b/ui-repolist.c index d12e3dd..54c6f6a 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -274,7 +274,7 @@ void cgit_print_repolist(void) int sorted = 0; if (!any_repos_visible()) { - cgit_print_error_page(404, "Not found", "No repositories found"); + cgit_print_error_page(404, "Not found", "No repositories found :("); return; } @@ -321,7 +321,12 @@ void cgit_print_repolist(void) } htmlf("", !sorted && section ? "sublevel-repo" : "toplevel-repo"); - cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); + /* TODO: ctx.repo->readme.nr is always equal to 6, but it should not be. + * The check does not work for now */ + if (!ctx.repo->readme.nr && !strcmp(ctx.cfg.default_index, "about")) + cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); + else + cgit_reporevlink(ctx.cfg.default_index, ctx.repo->name, NULL, NULL, NULL, NULL, NULL); html(""); repourl = cgit_repourl(ctx.repo->url); html_link_open(repourl, NULL, NULL); -- cgit v1.2.3-70-g09d2