List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 3/3] ui-tree: generate blame links
Date: Wed, 12 Aug 2015 14:03:36 +0100	[thread overview]
Message-ID: <7c8eb1bcb72581095a7c8ec69742cb7ab2e7acdb.1439384224.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1439384224.git.john@keeping.me.uk>

---
 ui-tree.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ui-tree.c b/ui-tree.c
index bbc468e..add0344 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -106,6 +106,11 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
 	htmlf("blob: %s (", sha1_to_hex(sha1));
 	cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
 		        rev, path);
+	if (ctx.cfg.enable_blame) {
+		html(" | ");
+		cgit_blame_link("blame", NULL, NULL, ctx.qry.head,
+				rev, path, -1);
+	}
 	html(")\n");
 
 	if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
@@ -173,6 +178,10 @@ static int ls_item(const unsigned char *sha1, struct strbuf *base,
 	if (!S_ISGITLINK(mode))
 		cgit_plain_link("plain", NULL, "button", ctx.qry.head,
 				walk_tree_ctx->curr_rev, fullpath.buf);
+	if (S_ISREG(mode) && ctx.cfg.enable_blame)
+		cgit_blame_link("blame", NULL, "button", ctx.qry.head,
+				walk_tree_ctx->curr_rev,
+				fullpath.buf, -1);
 	html("</td></tr>\n");
 	free(name);
 	strbuf_release(&fullpath);
-- 
2.5.0.466.g9af26fa



  parent reply	other threads:[~2015-08-12 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 13:03 [PATCH 0/3] Blame UI john
2015-08-12 13:03 ` [PATCH 1/3] ui-blame: add blame UI john
2015-08-12 13:03 ` [PATCH 2/3] ui-shared: add cgit_blame_link() john
2015-08-12 13:03 ` john [this message]
2015-08-12 13:44 ` [PATCH 0/3] Blame UI Jason
2015-08-12 15:02   ` john
2015-08-12 15:07     ` Jason
2015-08-12 15:26       ` john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c8eb1bcb72581095a7c8ec69742cb7ab2e7acdb.1439384224.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).