diff options
author | sterni <sternenseemann@systemli.org> | 2022-05-19T08·27+0200 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2022-05-19T08·45+0200 |
commit | 40803d9c6d1cf1acc286a40e400c8972ad5ce8d0 (patch) | |
tree | 5cd44d7e050af9ac4394d7d1ef64834ff7a6a852 /third_party/cgit/ui-shared.c | |
parent | e579aa66030bde44f2b0f7d3031c08af0f7d3a3c (diff) | |
parent | 0c86e2ac3f20fa43fabd2f7ff2dc3d16fadd08e0 (diff) |
subtree(3p/cgit): merge cgit-pink into depot cgit r/4094
cgit-pink is a maintained fork of cgit that follows upstream git more closely and already contains a lot of patches we already had applied. Consequently, it seems sensible it becomes our future upstream, we may even be able to upstream some of our custom, less invasive patches. Change-Id: Ia081e4508866f32298986c7160f4890c8a7c8922
Diffstat (limited to 'third_party/cgit/ui-shared.c')
-rw-r--r-- | third_party/cgit/ui-shared.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/third_party/cgit/ui-shared.c b/third_party/cgit/ui-shared.c index cf7907ffe393..2e8896c982dd 100644 --- a/third_party/cgit/ui-shared.c +++ b/third_party/cgit/ui-shared.c @@ -836,7 +836,7 @@ void cgit_print_docend(void) if (ctx.cfg.footer) html_include(ctx.cfg.footer); else { - htmlf("<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit %s</a> " + htmlf("<div class='footer'>generated by <a href='https://git.causal.agency/cgit-pink/about/'>cgit-pink %s</a> " "(<a href='https://git-scm.com/'>git %s</a>) at ", cgit_version, git_version_string); html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_DOTTIME))); html("</div>\n"); @@ -898,7 +898,7 @@ void cgit_add_clone_urls(void (*fn)(const char *)) static int print_this_commit_option(void) { struct object_id oid; - if (get_oid(ctx.qry.head, &oid)) + if (!ctx.qry.head || get_oid(ctx.qry.head, &oid)) return 1; html_option(oid_to_hex(&oid), "this commit", ctx.qry.head); return 0; @@ -1003,7 +1003,7 @@ static void print_header(void) html("<td class='main'>"); if (ctx.repo) { - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); + cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); if (ctx.env.authenticated) { html("</td><td class='form'>"); html("<form method='get'>\n"); @@ -1027,7 +1027,13 @@ static void print_header(void) if (ctx.repo) { html_txt(ctx.repo->desc); html("</td><td class='sub right'>"); - html_txt(ctx.repo->owner); + if (ctx.repo->owner_filter) { + cgit_open_filter(ctx.repo->owner_filter); + html_txt(ctx.repo->owner); + cgit_close_filter(ctx.repo->owner_filter); + } else { + html_txt(ctx.repo->owner); + } } else { if (ctx.cfg.root_desc) html_txt(ctx.cfg.root_desc); @@ -1046,29 +1052,37 @@ void cgit_print_pageheader(void) if (ctx.repo->readme.nr) { cgit_about_link("about", NULL, hc("about"), ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); + html(" "); } cgit_summary_link("summary", NULL, hc("summary"), ctx.qry.head); + html(" "); cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, ctx.qry.oid, NULL); + html(" "); cgit_log_link("log", NULL, hc("log"), ctx.qry.head, NULL, ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg, ctx.qry.follow); + html(" "); if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); else cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, - ctx.qry.oid, ctx.qry.vpath); + ctx.qry.oid, ctx.qry.vpath); + html(" "); cgit_commit_link("commit", NULL, hc("commit"), ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); + html(" "); cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, ctx.qry.oid, ctx.qry.oid2, ctx.qry.vpath); - if (ctx.repo->max_stats) + if (ctx.repo->max_stats) { + html(" "); cgit_stats_link("stats", NULL, hc("stats"), ctx.qry.head, ctx.qry.vpath); + } if (ctx.repo->homepage) { - html("<a href='"); + html(" <a href='"); html_attr(ctx.repo->homepage); html("'>homepage</a>"); } @@ -1212,9 +1226,12 @@ void cgit_set_title_from_path(const char *path) if (!path) return; - for (last_slash = path + strlen(path); (slash = memrchr(path, '/', last_slash - path)) != NULL; last_slash = slash) { + last_slash = path + strlen(path); + for (slash = last_slash; slash > path; --slash) { + if (*slash != '/') continue; strbuf_add(&sb, slash + 1, last_slash - slash - 1); strbuf_addstr(&sb, " \xc2\xab "); + last_slash = slash; } strbuf_add(&sb, path, last_slash - path); strbuf_addf(&sb, " - %s", ctx.page.title); |