From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 2/3] ui-shared: add cgit_blame_link()
Date: Wed, 12 Aug 2015 14:03:35 +0100 [thread overview]
Message-ID: <b6aecd3c8b0e30ed775a1fb69a05e3cd252d890d.1439384224.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1439384224.git.john@keeping.me.uk>
---
ui-shared.c | 40 ++++++++++++++++++++++++++++++++++++++++
ui-shared.h | 3 +++
2 files changed, 43 insertions(+)
diff --git a/ui-shared.c b/ui-shared.c
index ac5a287..da9c3d0 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -338,6 +338,46 @@ void cgit_log_link(const char *name, const char *title, const char *class,
html("</a>");
}
+void cgit_blame_link(char *name, const char *title, const char *class,
+ const char *head, const char *rev, const char *path,
+ long line)
+{
+ if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
+ name[ctx.cfg.max_msg_len] = '\0';
+ name[ctx.cfg.max_msg_len - 1] = '.';
+ name[ctx.cfg.max_msg_len - 2] = '.';
+ name[ctx.cfg.max_msg_len - 3] = '.';
+ }
+
+ char *delim;
+
+ delim = repolink(title, class, "blame", head, path);
+ if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
+ html(delim);
+ html("id=");
+ html_url_arg(rev);
+ delim = "&";
+ }
+ if (ctx.qry.difftype) {
+ html(delim);
+ htmlf("dt=%d", ctx.qry.difftype);
+ delim = "&";
+ }
+ if (ctx.qry.ignorews) {
+ html(delim);
+ html("ignorews=1");
+ delim = "&";
+ }
+ if (line >= 0)
+ htmlf("#l%ld", line);
+ html("'>");
+ if (name[0] != '\0')
+ html_txt(name);
+ else
+ html_txt("(no commit message)");
+ html("</a>");
+}
+
void cgit_commit_link(char *name, const char *title, const char *class,
const char *head, const char *rev, const char *path)
{
diff --git a/ui-shared.h b/ui-shared.h
index 1b8ecb5..9a406d0 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -30,6 +30,9 @@ extern void cgit_log_link(const char *name, const char *title,
const char *class, const char *head, const char *rev,
const char *path, int ofs, const char *grep,
const char *pattern, int showmsg);
+extern void cgit_blame_link(char *name, const char *title,
+ const char *class, const char *head,
+ const char *rev, const char *path, long line);
extern void cgit_commit_link(char *name, const char *title,
const char *class, const char *head,
const char *rev, const char *path);
--
2.5.0.466.g9af26fa
next prev 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 ` john [this message]
2015-08-12 13:03 ` [PATCH 3/3] ui-tree: generate blame links john
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=b6aecd3c8b0e30ed775a1fb69a05e3cd252d890d.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).