diff options
| -rw-r--r-- | ui-shared.c | 20 | ||||
| -rw-r--r-- | ui-shared.h | 3 | ||||
| -rw-r--r-- | ui-tree.c | 10 |
3 files changed, 29 insertions, 4 deletions
diff --git a/ui-shared.c b/ui-shared.c index 315dedb..07c78a5 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* ui-shared.c: common web output functions | 1 | /* ui-shared.c: common web output functions |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com> | 3 | * Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com> |
| 4 | * | 4 | * |
| 5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
| 6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
| @@ -304,6 +304,12 @@ void cgit_plain_link(const char *name, const char *title, const char *class, | |||
| 304 | reporevlink("plain", name, title, class, head, rev, path); | 304 | reporevlink("plain", name, title, class, head, rev, path); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | void cgit_blame_link(const char *name, const char *title, const char *class, | ||
| 308 | const char *head, const char *rev, const char *path) | ||
| 309 | { | ||
| 310 | reporevlink("blame", name, title, class, head, rev, path); | ||
| 311 | } | ||
| 312 | |||
| 307 | void cgit_log_link(const char *name, const char *title, const char *class, | 313 | void cgit_log_link(const char *name, const char *title, const char *class, |
| 308 | const char *head, const char *rev, const char *path, | 314 | const char *head, const char *rev, const char *path, |
| 309 | int ofs, const char *grep, const char *pattern, int showmsg, | 315 | 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) | |||
| 478 | cgit_plain_link(name, title, class, ctx.qry.head, | 484 | cgit_plain_link(name, title, class, ctx.qry.head, |
| 479 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 485 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
| 480 | ctx.qry.path); | 486 | ctx.qry.path); |
| 487 | else if (!strcmp(ctx.qry.page, "blame")) | ||
| 488 | cgit_blame_link(name, title, class, ctx.qry.head, | ||
| 489 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | ||
| 490 | ctx.qry.path); | ||
| 481 | else if (!strcmp(ctx.qry.page, "log")) | 491 | else if (!strcmp(ctx.qry.page, "log")) |
| 482 | cgit_log_link(name, title, class, ctx.qry.head, | 492 | cgit_log_link(name, title, class, ctx.qry.head, |
| 483 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 493 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
| @@ -983,8 +993,12 @@ void cgit_print_pageheader(void) | |||
| 983 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, | 993 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, |
| 984 | NULL, ctx.qry.vpath, 0, NULL, NULL, | 994 | NULL, ctx.qry.vpath, 0, NULL, NULL, |
| 985 | ctx.qry.showmsg, ctx.qry.follow); | 995 | ctx.qry.showmsg, ctx.qry.follow); |
| 986 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, | 996 | if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) |
| 987 | ctx.qry.sha1, ctx.qry.vpath); | 997 | cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, |
| 998 | ctx.qry.sha1, ctx.qry.vpath); | ||
| 999 | else | ||
| 1000 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, | ||
| 1001 | ctx.qry.sha1, ctx.qry.vpath); | ||
| 988 | cgit_commit_link("commit", NULL, hc("commit"), | 1002 | cgit_commit_link("commit", NULL, hc("commit"), |
| 989 | ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath); | 1003 | ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath); |
| 990 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, | 1004 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, |
diff --git a/ui-shared.h b/ui-shared.h index 2cd7ac9..b760a17 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
| @@ -26,6 +26,9 @@ extern void cgit_tree_link(const char *name, const char *title, | |||
| 26 | extern void cgit_plain_link(const char *name, const char *title, | 26 | extern void cgit_plain_link(const char *name, const char *title, |
| 27 | const char *class, const char *head, | 27 | const char *class, const char *head, |
| 28 | const char *rev, const char *path); | 28 | const char *rev, const char *path); |
| 29 | extern void cgit_blame_link(const char *name, const char *title, | ||
| 30 | const char *class, const char *head, | ||
| 31 | const char *rev, const char *path); | ||
| 29 | extern void cgit_log_link(const char *name, const char *title, | 32 | extern void cgit_log_link(const char *name, const char *title, |
| 30 | const char *class, const char *head, const char *rev, | 33 | const char *class, const char *head, const char *rev, |
| 31 | const char *path, int ofs, const char *grep, | 34 | const char *path, int ofs, const char *grep, |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* ui-tree.c: functions for tree output | 1 | /* ui-tree.c: functions for tree output |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com> | 3 | * Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com> |
| 4 | * | 4 | * |
| 5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
| 6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
| @@ -110,6 +110,11 @@ static void print_object(const unsigned char *sha1, char *path, const char *base | |||
| 110 | htmlf("blob: %s (", sha1_to_hex(sha1)); | 110 | htmlf("blob: %s (", sha1_to_hex(sha1)); |
| 111 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, | 111 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, |
| 112 | rev, path); | 112 | rev, path); |
| 113 | if (ctx.cfg.enable_blame) { | ||
| 114 | html(") ("); | ||
| 115 | cgit_blame_link("blame", NULL, NULL, ctx.qry.head, | ||
| 116 | rev, path); | ||
| 117 | } | ||
| 113 | html(")\n"); | 118 | html(")\n"); |
| 114 | 119 | ||
| 115 | if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { | 120 | 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, | |||
| 244 | if (!S_ISGITLINK(mode)) | 249 | if (!S_ISGITLINK(mode)) |
| 245 | cgit_plain_link("plain", NULL, "button", ctx.qry.head, | 250 | cgit_plain_link("plain", NULL, "button", ctx.qry.head, |
| 246 | walk_tree_ctx->curr_rev, fullpath.buf); | 251 | walk_tree_ctx->curr_rev, fullpath.buf); |
| 252 | if (!S_ISDIR(mode) && ctx.cfg.enable_blame) | ||
| 253 | cgit_blame_link("blame", NULL, "button", ctx.qry.head, | ||
| 254 | walk_tree_ctx->curr_rev, fullpath.buf); | ||
| 247 | html("</td></tr>\n"); | 255 | html("</td></tr>\n"); |
| 248 | free(name); | 256 | free(name); |
| 249 | strbuf_release(&fullpath); | 257 | strbuf_release(&fullpath); |
