[PATCH 2/2] cmd: redirect empty about/ to homepage or summary
Jason A. Donenfeld
Jason at zx2c4.com
Mon Feb 22 16:39:50 CET 2016
Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
---
cmd.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/cmd.c b/cmd.c
index 3093c62..0375c5a 100644
--- a/cmd.c
+++ b/cmd.c
@@ -47,8 +47,17 @@ static void about_fn(void)
cgit_redirect(redirect, true);
free(currenturl);
free(redirect);
- } else
+ } else if (ctx.repo->readme.nr)
cgit_print_repo_readme(ctx.qry.path);
+ else if (ctx.repo->homepage)
+ cgit_redirect(ctx.repo->homepage, false);
+ else {
+ char *currenturl = cgit_currenturl();
+ char *redirect = fmtalloc("%s../", currenturl);
+ cgit_redirect(redirect, false);
+ free(currenturl);
+ free(redirect);
+ }
} else
cgit_print_site_readme();
}
--
2.7.1
More information about the CGit
mailing list