From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 1/2] filter: introduce cgit_open_email_filter() wrapper
Date: Thu, 25 Aug 2016 21:13:11 +0100 [thread overview]
Message-ID: <7bf3e6c3af29ba8a2852434b4fd4654f2ea8cf42.1472155992.git.john@keeping.me.uk> (raw)
In-Reply-To: <20160825201211.l7q5o4ljmeqoawdr@john.keeping.me.uk>
We provide email addresses to the email filter surrounded by angle
brackets, but we will soon remove these in our internal representation.
Introduce a wrapper so that we only have to add them in one place.
Signed-off-by: John Keeping <john at keeping.me.uk>
---
It might be nice for this to be symmetric with a new
cgit_close_email_filter() thin wrapper as well, but I haven't bothered
with that in this first pass.
---
cgit.h | 2 ++
filter.c | 5 +++++
ui-commit.c | 4 ++--
ui-log.c | 2 +-
ui-refs.c | 4 ++--
5 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/cgit.h b/cgit.h
index 325432b..7331965 100644
--- a/cgit.h
+++ b/cgit.h
@@ -383,6 +383,8 @@ extern struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filterty
extern void cgit_cleanup_filters(void);
extern void cgit_init_filters(void);
+extern void cgit_open_email_filter(const char *email, const char *origin);
+
extern void cgit_prepare_repo_env(struct cgit_repo * repo);
extern int readfile(const char *path, char **buf, size_t *size);
diff --git a/filter.c b/filter.c
index 949c931..88098ba 100644
--- a/filter.c
+++ b/filter.c
@@ -454,3 +454,8 @@ struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype)
die("Invalid filter type: %.*s", (int) len, cmd);
}
+
+void cgit_open_email_filter(const char *email, const char *origin)
+{
+ cgit_open_filter(ctx.repo->email_filter, email, origin);
+}
diff --git a/ui-commit.c b/ui-commit.c
index 099d294..95958e0 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -47,7 +47,7 @@ void cgit_print_commit(char *hex, const char *prefix)
cgit_print_diff_ctrls();
html("<table summary='commit info' class='commit-info'>\n");
html("<tr><th>author</th><td>");
- cgit_open_filter(ctx.repo->email_filter, info->author_email, "commit");
+ cgit_open_email_filter(info->author_email, "commit");
html_txt(info->author);
if (!ctx.cfg.noplainemail) {
html(" ");
@@ -59,7 +59,7 @@ void cgit_print_commit(char *hex, const char *prefix)
cgit_date_mode(DATE_ISO8601)));
html("</td></tr>\n");
html("<tr><th>committer</th><td>");
- cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit");
+ cgit_open_email_filter(info->committer_email, "commit");
html_txt(info->committer);
if (!ctx.cfg.noplainemail) {
html(" ");
diff --git a/ui-log.c b/ui-log.c
index c97b8e0..7baf5e8 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -238,7 +238,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
oid_to_hex(&commit->object.oid), ctx.qry.vpath);
show_commit_decorations(commit);
html("</td><td>");
- cgit_open_filter(ctx.repo->email_filter, info->author_email, "log");
+ cgit_open_email_filter(info->author_email, "log");
html_txt(info->author);
cgit_close_filter(ctx.repo->email_filter);
diff --git a/ui-refs.c b/ui-refs.c
index 75f2789..ffb9bb1 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -69,7 +69,7 @@ static int print_branch(struct refinfo *ref)
if (ref->object->type == OBJ_COMMIT) {
cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL);
html("</td><td>");
- cgit_open_filter(ctx.repo->email_filter, info->author_email, "refs");
+ cgit_open_email_filter(info->author_email, "refs");
html_txt(info->author);
cgit_close_filter(ctx.repo->email_filter);
html("</td><td colspan='2'>");
@@ -148,7 +148,7 @@ static int print_tag(struct refinfo *ref)
cgit_close_filter(ctx.repo->email_filter);
}
} else if (ref->object->type == OBJ_COMMIT) {
- cgit_open_filter(ctx.repo->email_filter, ref->commit->author_email, "refs");
+ cgit_open_email_filter(ref->commit->author_email, "refs");
html_txt(ref->commit->author);
cgit_close_filter(ctx.repo->email_filter);
}
--
2.10.0.rc0.142.g1e9f63b
next prev parent reply other threads:[~2016-08-25 20:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 18:28 [PATCH] Add support for git's mailmap smithj4
2016-08-24 19:23 ` john
2016-08-24 21:27 ` smithj4
2016-08-24 21:38 ` smithj4
2016-08-24 22:30 ` john
2016-08-25 19:22 ` smithj4
2016-08-25 20:12 ` john
2016-08-25 20:13 ` john [this message]
2016-08-25 20:13 ` [PATCH 2/2] Remove angle brackets from {author,committer}_email john
2016-08-26 20:11 ` [PATCH] Add support for git's mailmap smithj4
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=7bf3e6c3af29ba8a2852434b4fd4654f2ea8cf42.1472155992.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).