An extra '>' is added in some cases (<spearce@xxxxxxxxxxx>>), for example: % git blame -e -L 947,+7 contrib/completion/git-completion.bash v1.7.9 The current code assumes map_user() *always* returns plain emails, but that's not true; when there's no email substitution (only name), map_user() would return 1, but don't touch the mail. Also, add some tests. This got broken by d20d654[1]. [1] Change current mailmap usage to do matching on both name and email of author/committer. Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- builtin/blame.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 5a67c20..dd69e51 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1403,10 +1403,13 @@ static void get_ac_line(const char *inbuf, const char *what, * Now, convert both name and e-mail using mailmap */ if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) { - /* Add a trailing '>' to email, since map_user returns plain emails - Note: It already has '<', since we replace from mail+1 */ + /* + * Add a trailing '>' to email, since map_user returns plain + * emails when it finds a matching mail. + * Note: It already has '<', since we replace from mail + 1 + */ mailpos = memchr(mail, '\0', mail_len); - if (mailpos && mailpos-mail < mail_len - 1) { + if (mailpos && mailpos-mail < mail_len - 1 && *(mailpos - 1) != '>') { *mailpos = '>'; *(mailpos+1) = '\0'; } -- 1.7.9.1.g97f7d -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html