diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-21T18·41+0000 |
---|---|---|
committer | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·47+0000 |
commit | 8de22f654c725999b6a2ce39edfbb78806452e1a (patch) | |
tree | 86aea0dd6b0a1f99a983cce8aa4224b2151c9f15 /third_party/cgit/cmd.c | |
parent | 8082d87da385e2a4aeaff915799d26feb42b83af (diff) |
feat(third_party/cgit): Generate monorepo compatible URLs r/375
Generates URLs that do not include the repository name. On git.tazj.in, only one repository (depot) is served - hence URLs generated by cgit need not include the name.
Diffstat (limited to 'third_party/cgit/cmd.c')
-rw-r--r-- | third_party/cgit/cmd.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/third_party/cgit/cmd.c b/third_party/cgit/cmd.c index bf6d8f516fe0..0fd0a01bc87f 100644 --- a/third_party/cgit/cmd.c +++ b/third_party/cgit/cmd.c @@ -39,29 +39,7 @@ static void atom_fn(void) static void about_fn(void) { - if (ctx.repo) { - size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0; - if (!ctx.qry.path && - ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && - (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) { - char *currenturl = cgit_currenturl(); - char *redirect = fmtalloc("%s/", currenturl); - cgit_redirect(redirect, true); - free(currenturl); - free(redirect); - } 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(); + cgit_print_repo_readme(ctx.qry.path); } static void blame_fn(void) |