aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorJason A. Donenfeld2016-02-22 16:33:49 +0100
committerJason A. Donenfeld2016-02-22 18:40:15 +0100
commit94c02bbf732d938c92df4961026c4d8f6fd4c37e (patch)
treeebab72fb96cf3fcd3de23078173c14f5dd7c7f58 /cmd.c
parent5f2664f13c90f083b827d8fafa6cfc01c0c4f513 (diff)
downloadcgit-94c02bbf732d938c92df4961026c4d8f6fd4c37e.tar.gz
cgit-94c02bbf732d938c92df4961026c4d8f6fd4c37e.tar.bz2
cgit-94c02bbf732d938c92df4961026c4d8f6fd4c37e.zip
cmd: redirect empty about/ to homepage or summary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c11
1 files changed, 10 insertions, 1 deletions
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)
47 cgit_redirect(redirect, true); 47 cgit_redirect(redirect, true);
48 free(currenturl); 48 free(currenturl);
49 free(redirect); 49 free(redirect);
50 } else 50 } else if (ctx.repo->readme.nr)
51 cgit_print_repo_readme(ctx.qry.path); 51 cgit_print_repo_readme(ctx.qry.path);
52 else if (ctx.repo->homepage)
53 cgit_redirect(ctx.repo->homepage, false);
54 else {
55 char *currenturl = cgit_currenturl();
56 char *redirect = fmtalloc("%s../", currenturl);
57 cgit_redirect(redirect, false);
58 free(currenturl);
59 free(redirect);
60 }
52 } else 61 } else
53 cgit_print_site_readme(); 62 cgit_print_site_readme();
54} 63}