From be2f51e1dd583cb3e03572aaab2fff682ba849ee Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 21 Dec 2019 23:27:28 +0000 Subject: feat(third_party/cgit): Generate links to about pages from subtrees If you're on tree/foo/bar, the about link will now point to about/foo/bar. Currently the annoying thing about this is that it will also do it for files. --- third_party/cgit/ui-shared.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'third_party') diff --git a/third_party/cgit/ui-shared.c b/third_party/cgit/ui-shared.c index 0b9307f55d..00efbceb20 100644 --- a/third_party/cgit/ui-shared.c +++ b/third_party/cgit/ui-shared.c @@ -330,6 +330,12 @@ void cgit_tag_link(const char *name, const char *title, const char *class, reporevlink("tag", name, title, class, tag, NULL, NULL); } +void cgit_about_link(const char *name, const char *title, const char *class, + const char *head, const char *rev, const char *path) +{ + reporevlink("about", name, title, class, head, rev, path); +} + void cgit_tree_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path) { @@ -1020,10 +1026,10 @@ void cgit_print_pageheader(void) html("
\n"); if (ctx.env.authenticated && ctx.repo) { - if (ctx.repo->readme.nr) - reporevlink("about", "about", NULL, - hc("about"), ctx.qry.head, NULL, - NULL); + if (ctx.repo->readme.nr) { + cgit_about_link("about", NULL, hc("about"), ctx.qry.head, + ctx.qry.sha1, ctx.qry.vpath); + } cgit_summary_link("summary", NULL, hc("summary"), ctx.qry.head); cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, -- cgit 1.4.1