ui-tree: link to blame UI if enabled
Create links to the blame page. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
parent
c1cd290d1f
commit
1649afdc9b
16
ui-shared.c
16
ui-shared.c
@ -1,6 +1,6 @@
|
|||||||
/* ui-shared.c: common web output functions
|
/* ui-shared.c: common web output functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
|
* Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com>
|
||||||
*
|
*
|
||||||
* Licensed under GNU General Public License v2
|
* Licensed under GNU General Public License v2
|
||||||
* (see COPYING for full license text)
|
* (see COPYING for full license text)
|
||||||
@ -304,6 +304,12 @@ void cgit_plain_link(const char *name, const char *title, const char *class,
|
|||||||
reporevlink("plain", name, title, class, head, rev, path);
|
reporevlink("plain", name, title, class, head, rev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cgit_blame_link(const char *name, const char *title, const char *class,
|
||||||
|
const char *head, const char *rev, const char *path)
|
||||||
|
{
|
||||||
|
reporevlink("blame", name, title, class, head, rev, path);
|
||||||
|
}
|
||||||
|
|
||||||
void cgit_log_link(const char *name, const char *title, const char *class,
|
void cgit_log_link(const char *name, const char *title, const char *class,
|
||||||
const char *head, const char *rev, const char *path,
|
const char *head, const char *rev, const char *path,
|
||||||
int ofs, const char *grep, const char *pattern, int showmsg,
|
int ofs, const char *grep, const char *pattern, int showmsg,
|
||||||
@ -478,6 +484,10 @@ static void cgit_self_link(char *name, const char *title, const char *class)
|
|||||||
cgit_plain_link(name, title, class, ctx.qry.head,
|
cgit_plain_link(name, title, class, ctx.qry.head,
|
||||||
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
|
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
|
||||||
ctx.qry.path);
|
ctx.qry.path);
|
||||||
|
else if (!strcmp(ctx.qry.page, "blame"))
|
||||||
|
cgit_blame_link(name, title, class, ctx.qry.head,
|
||||||
|
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
|
||||||
|
ctx.qry.path);
|
||||||
else if (!strcmp(ctx.qry.page, "log"))
|
else if (!strcmp(ctx.qry.page, "log"))
|
||||||
cgit_log_link(name, title, class, ctx.qry.head,
|
cgit_log_link(name, title, class, ctx.qry.head,
|
||||||
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
|
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
|
||||||
@ -983,6 +993,10 @@ void cgit_print_pageheader(void)
|
|||||||
cgit_log_link("log", NULL, hc("log"), ctx.qry.head,
|
cgit_log_link("log", NULL, hc("log"), ctx.qry.head,
|
||||||
NULL, ctx.qry.vpath, 0, NULL, NULL,
|
NULL, ctx.qry.vpath, 0, NULL, NULL,
|
||||||
ctx.qry.showmsg, ctx.qry.follow);
|
ctx.qry.showmsg, ctx.qry.follow);
|
||||||
|
if (ctx.qry.page && !strcmp(ctx.qry.page, "blame"))
|
||||||
|
cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head,
|
||||||
|
ctx.qry.sha1, ctx.qry.vpath);
|
||||||
|
else
|
||||||
cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head,
|
cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head,
|
||||||
ctx.qry.sha1, ctx.qry.vpath);
|
ctx.qry.sha1, ctx.qry.vpath);
|
||||||
cgit_commit_link("commit", NULL, hc("commit"),
|
cgit_commit_link("commit", NULL, hc("commit"),
|
||||||
|
@ -26,6 +26,9 @@ extern void cgit_tree_link(const char *name, const char *title,
|
|||||||
extern void cgit_plain_link(const char *name, const char *title,
|
extern void cgit_plain_link(const char *name, const char *title,
|
||||||
const char *class, const char *head,
|
const char *class, const char *head,
|
||||||
const char *rev, const char *path);
|
const char *rev, const char *path);
|
||||||
|
extern void cgit_blame_link(const char *name, const char *title,
|
||||||
|
const char *class, const char *head,
|
||||||
|
const char *rev, const char *path);
|
||||||
extern void cgit_log_link(const char *name, const char *title,
|
extern void cgit_log_link(const char *name, const char *title,
|
||||||
const char *class, const char *head, const char *rev,
|
const char *class, const char *head, const char *rev,
|
||||||
const char *path, int ofs, const char *grep,
|
const char *path, int ofs, const char *grep,
|
||||||
|
10
ui-tree.c
10
ui-tree.c
@ -1,6 +1,6 @@
|
|||||||
/* ui-tree.c: functions for tree output
|
/* ui-tree.c: functions for tree output
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
|
* Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com>
|
||||||
*
|
*
|
||||||
* Licensed under GNU General Public License v2
|
* Licensed under GNU General Public License v2
|
||||||
* (see COPYING for full license text)
|
* (see COPYING for full license text)
|
||||||
@ -110,6 +110,11 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
|
|||||||
htmlf("blob: %s (", sha1_to_hex(sha1));
|
htmlf("blob: %s (", sha1_to_hex(sha1));
|
||||||
cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
|
cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
|
||||||
rev, path);
|
rev, path);
|
||||||
|
if (ctx.cfg.enable_blame) {
|
||||||
|
html(") (");
|
||||||
|
cgit_blame_link("blame", NULL, NULL, ctx.qry.head,
|
||||||
|
rev, path);
|
||||||
|
}
|
||||||
html(")\n");
|
html(")\n");
|
||||||
|
|
||||||
if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
|
if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
|
||||||
@ -244,6 +249,9 @@ static int ls_item(const unsigned char *sha1, struct strbuf *base,
|
|||||||
if (!S_ISGITLINK(mode))
|
if (!S_ISGITLINK(mode))
|
||||||
cgit_plain_link("plain", NULL, "button", ctx.qry.head,
|
cgit_plain_link("plain", NULL, "button", ctx.qry.head,
|
||||||
walk_tree_ctx->curr_rev, fullpath.buf);
|
walk_tree_ctx->curr_rev, fullpath.buf);
|
||||||
|
if (!S_ISDIR(mode) && ctx.cfg.enable_blame)
|
||||||
|
cgit_blame_link("blame", NULL, "button", ctx.qry.head,
|
||||||
|
walk_tree_ctx->curr_rev, fullpath.buf);
|
||||||
html("</td></tr>\n");
|
html("</td></tr>\n");
|
||||||
free(name);
|
free(name);
|
||||||
strbuf_release(&fullpath);
|
strbuf_release(&fullpath);
|
||||||
|
Loading…
Reference in New Issue
Block a user