* [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper [not found] <cover.1487952449.git.smithj4@bnl.gov> @ 2017-02-24 16:18 ` john 2017-02-25 9:01 ` Jason 2017-02-24 16:19 ` [PATCH 2/3] Remove angle brackets from {author,committer}_email john 2017-02-24 16:19 ` [PATCH 3/3] Add support for git's mailmap smithj4 2 siblings, 1 reply; 7+ messages in thread From: john @ 2017-02-24 16:18 UTC (permalink / raw) 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> Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- cgit.h | 2 ++ filter.c | 5 +++++ ui-commit.c | 4 ++-- ui-log.c | 2 +- ui-refs.c | 6 +++--- ui-tag.c | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-filter-introduce-cgit_open_email_filter-wrapper.patch Type: text/x-patch Size: 3803 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20170224/a3237e8e/attachment.bin> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper 2017-02-24 16:18 ` [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper john @ 2017-02-25 9:01 ` Jason 0 siblings, 0 replies; 7+ messages in thread From: Jason @ 2017-02-25 9:01 UTC (permalink / raw) Can you resubmit this series as a normal git-send-email situation? Very hard to review as attachments like this. Thanks, Jason ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] Remove angle brackets from {author,committer}_email [not found] <cover.1487952449.git.smithj4@bnl.gov> 2017-02-24 16:18 ` [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper john @ 2017-02-24 16:19 ` john 2017-02-24 16:19 ` [PATCH 3/3] Add support for git's mailmap smithj4 2 siblings, 0 replies; 7+ messages in thread From: john @ 2017-02-24 16:19 UTC (permalink / raw) This matches the internal representation in libgit.a, so it will make it much easier to use Git's mailmap code. The change in ui-atom.c isn't strictly necessary since the code copes with email addresses both with and without angle brackets, but it's a nice simplification since we know that the email address will always be provided in the correct form. Signed-off-by: John Keeping <john at keeping.me.uk> Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- filter.c | 10 +++++++++- parsing.c | 6 +----- ui-atom.c | 13 +------------ ui-commit.c | 6 ++++-- ui-tag.c | 3 ++- 5 files changed, 17 insertions(+), 21 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Remove-angle-brackets-from-author-committer-_email.patch Type: text/x-patch Size: 3385 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20170224/9913690b/attachment.bin> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] Add support for git's mailmap. [not found] <cover.1487952449.git.smithj4@bnl.gov> 2017-02-24 16:18 ` [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper john 2017-02-24 16:19 ` [PATCH 2/3] Remove angle brackets from {author,committer}_email john @ 2017-02-24 16:19 ` smithj4 2 siblings, 0 replies; 7+ messages in thread From: smithj4 @ 2017-02-24 16:19 UTC (permalink / raw) If a mailmap file is present in the repo, it will be used to coalesce commits by the same person, just like git does. When no mailmap file is found then it functions as before. Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- cgit.h | 3 +++ parsing.c | 21 +++++++++++++++++++++ ui-atom.c | 20 ++++++++++++++------ ui-commit.c | 22 ++++++++++++++++------ ui-log.c | 11 +++++++++-- ui-refs.c | 32 ++++++++++++++++++++++++++------ ui-stats.c | 13 ++++++++++--- ui-tag.c | 14 ++++++++++---- 8 files changed, 109 insertions(+), 27 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-Add-support-for-git-s-mailmap.patch Type: text/x-patch Size: 13085 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20170224/1c560ad6/attachment-0001.bin> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/3] Add support for git's mailmap. @ 2017-02-25 16:12 smithj4 2017-02-25 16:12 ` [PATCH 2/3] Remove angle brackets from {author,committer}_email smithj4 0 siblings, 1 reply; 7+ messages in thread From: smithj4 @ 2017-02-25 16:12 UTC (permalink / raw) Sorry, I was using imap-send and used attachments to keep my thunderbird mail client from line-wrapping the patches. Jason A. Smith (1): Add support for git's mailmap. John Keeping (2): filter: introduce cgit_open_email_filter() wrapper Remove angle brackets from {author,committer}_email cgit.h | 5 +++++ filter.c | 13 +++++++++++++ parsing.c | 27 ++++++++++++++++++++++----- ui-atom.c | 31 ++++++++++++++----------------- ui-commit.c | 28 ++++++++++++++++++++-------- ui-log.c | 11 +++++++++-- ui-refs.c | 32 ++++++++++++++++++++++++++------ ui-stats.c | 13 ++++++++++--- ui-tag.c | 17 ++++++++++++----- 9 files changed, 131 insertions(+), 46 deletions(-) -- 2.9.3 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] Remove angle brackets from {author,committer}_email 2017-02-25 16:12 [PATCH 0/3] " smithj4 @ 2017-02-25 16:12 ` smithj4 0 siblings, 0 replies; 7+ messages in thread From: smithj4 @ 2017-02-25 16:12 UTC (permalink / raw) From: John Keeping <john at keeping.me.uk> This matches the internal representation in libgit.a, so it will make it much easier to use Git's mailmap code. The change in ui-atom.c isn't strictly necessary since the code copes with email addresses both with and without angle brackets, but it's a nice simplification since we know that the email address will always be provided in the correct form. Signed-off-by: John Keeping <john at keeping.me.uk> Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- filter.c | 10 +++++++++- parsing.c | 6 +----- ui-atom.c | 13 +------------ ui-commit.c | 6 ++++-- ui-tag.c | 3 ++- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/filter.c b/filter.c index 88098ba..ba9000a 100644 --- a/filter.c +++ b/filter.c @@ -457,5 +457,13 @@ struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype) void cgit_open_email_filter(const char *email, const char *origin) { - cgit_open_filter(ctx.repo->email_filter, email, origin); + struct strbuf sb = STRBUF_INIT; + + /* Don't bother allocating any memory if we don't have a filter. */ + if (!ctx.repo->email_filter) + return; + + strbuf_addf(&sb, "<%s>", email); + cgit_open_filter(ctx.repo->email_filter, sb.buf, origin); + strbuf_release(&sb); } diff --git a/parsing.c b/parsing.c index 9dacb16..352338d 100644 --- a/parsing.c +++ b/parsing.c @@ -72,14 +72,10 @@ static char *substr(const char *head, const char *tail) static void parse_user(const char *t, char **name, char **email, unsigned long *date, int *tz) { struct ident_split ident; - unsigned email_len; if (!split_ident_line(&ident, t, strchrnul(t, '\n') - t)) { *name = substr(ident.name_begin, ident.name_end); - - email_len = ident.mail_end - ident.mail_begin; - *email = xmalloc(strlen("<") + email_len + strlen(">") + 1); - sprintf(*email, "<%.*s>", email_len, ident.mail_begin); + *email = substr(ident.mail_begin, ident.mail_end); if (ident.date_begin) *date = strtoul(ident.date_begin, NULL, 10); diff --git a/ui-atom.c b/ui-atom.c index 41838d3..7c17d6a 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -15,7 +15,6 @@ static void add_entry(struct commit *commit, const char *host) { char delim = '&'; char *hex; - char *mail, *t, *t2; struct commitinfo *info; info = cgit_parse_commit(commit); @@ -35,19 +34,9 @@ static void add_entry(struct commit *commit, const char *host) html("</name>\n"); } if (info->author_email && !ctx.cfg.noplainemail) { - mail = xstrdup(info->author_email); - t = strchr(mail, '<'); - if (t) - t++; - else - t = mail; - t2 = strchr(t, '>'); - if (t2) - *t2 = '\0'; html("<email>"); - html_txt(t); + html_txt(info->author_email); html("</email>\n"); - free(mail); } html("</author>\n"); html("<published>"); diff --git a/ui-commit.c b/ui-commit.c index 04f0411..dccb5f3 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -50,8 +50,9 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_open_email_filter(info->author_email, "commit"); html_txt(info->author); if (!ctx.cfg.noplainemail) { - html(" "); + html(" <"); html_txt(info->author_email); + html(">"); } cgit_close_filter(ctx.repo->email_filter); html("</td><td class='right'>"); @@ -62,8 +63,9 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_open_email_filter(info->committer_email, "commit"); html_txt(info->committer); if (!ctx.cfg.noplainemail) { - html(" "); + html(" <"); html_txt(info->committer_email); + html(">"); } cgit_close_filter(ctx.repo->email_filter); html("</td><td class='right'>"); diff --git a/ui-tag.c b/ui-tag.c index d1e5db9..ad7854e 100644 --- a/ui-tag.c +++ b/ui-tag.c @@ -86,8 +86,9 @@ void cgit_print_tag(char *revname) cgit_open_email_filter(info->tagger_email, "tag"); html_txt(info->tagger); if (info->tagger_email && !ctx.cfg.noplainemail) { - html(" "); + html(" <"); html_txt(info->tagger_email); + html(">"); } cgit_close_filter(ctx.repo->email_filter); html("</td></tr>\n"); -- 2.9.3 ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <b710a9bcd7a1408c429ec09f535916074b957d25.1472494937.git.smithj4@bnl.gov>]
* [PATCH 2/3] Remove angle brackets from {author,committer}_email [not found] <b710a9bcd7a1408c429ec09f535916074b957d25.1472494937.git.smithj4@bnl.gov> @ 2016-08-29 18:28 ` john 0 siblings, 0 replies; 7+ messages in thread From: john @ 2016-08-29 18:28 UTC (permalink / raw) This matches the internal representation in libgit.a, so it will make it much easier to use Git's mailmap code. The change in ui-atom.c isn't strictly necessary since the code copes with email addresses both with and without angle brackets, but it's a nice simplification since we know that the email address will always be provided in the correct form. Signed-off-by: John Keeping <john at keeping.me.uk> Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- filter.c | 10 +++++++++- parsing.c | 6 +----- ui-atom.c | 13 +------------ ui-commit.c | 6 ++++-- ui-tag.c | 3 ++- 5 files changed, 17 insertions(+), 21 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Remove-angle-brackets-from-author-committer-_email.patch Type: text/x-patch Size: 3385 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20160829/cab1a1fa/attachment.bin> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] Remove angle brackets from {author,committer}_email @ 2016-08-26 20:12 john 0 siblings, 0 replies; 7+ messages in thread From: john @ 2016-08-26 20:12 UTC (permalink / raw) This matches the internal representation in libgit.a, so it will make it much easier to use Git's mailmap code. The change in ui-atom.c isn't strictly necessary since the code copes with email addresses both with and without angle brackets, but it's a nice simplification since we know that the email address will always be provided in the correct form. Signed-off-by: John Keeping <john at keeping.me.uk> Signed-off-by: Jason A. Smith <smithj4 at bnl.gov> --- filter.c | 10 +++++++++- parsing.c | 6 +----- ui-atom.c | 13 +------------ ui-commit.c | 6 ++++-- 4 files changed, 15 insertions(+), 20 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Remove-angle-brackets-from-author-committer-_email.patch Type: text/x-patch Size: 2932 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20160826/88bde046/attachment.bin> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-25 16:12 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <cover.1487952449.git.smithj4@bnl.gov> 2017-02-24 16:18 ` [PATCH 1/3] filter: introduce cgit_open_email_filter() wrapper john 2017-02-25 9:01 ` Jason 2017-02-24 16:19 ` [PATCH 2/3] Remove angle brackets from {author,committer}_email john 2017-02-24 16:19 ` [PATCH 3/3] Add support for git's mailmap smithj4 2017-02-25 16:12 [PATCH 0/3] " smithj4 2017-02-25 16:12 ` [PATCH 2/3] Remove angle brackets from {author,committer}_email smithj4 [not found] <b710a9bcd7a1408c429ec09f535916074b957d25.1472494937.git.smithj4@bnl.gov> 2016-08-29 18:28 ` john -- strict thread matches above, loose matches on Subject: below -- 2016-08-26 20:12 john
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).