On Sat, Feb 04, 2012 at 05:46:05PM +0200, Felipe Contreras wrote: > In any case, the one to blame for the header corruption is git: > [...] > f2bb9f88 (<spearce@xxxxxxxxxxx>> 2006-11-27 03:41:01 -0500 952) > > Notice the mail is wrong. Ugh. The fault lies in this code: $ sed -n 1405,1414p builtin/blame.c 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 */ mailpos = memchr(mail, '\0', mail_len); if (mailpos && mailpos-mail < mail_len - 1) { *mailpos = '>'; *(mailpos+1) = '\0'; } } } But that comment is wrong. If there's no email mapping needed, map_user will leave the "mail" buffer intact, in which case it will have the trailing ">" (because we feed the address with enclosing angle brackets). So while map_user tries to accept either "foo@xxxxxxxxxxx\0" and "foo@xxxxxxxxxxx>", it is up to the contents of the mailmap whether you get back something with the closing angle bracket or not. Which is a pretty error-prone interface. You can fix it with this: diff --git a/builtin/blame.c b/builtin/blame.c index 5a67c20..9b886fa 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1406,7 +1406,8 @@ static void get_ac_line(const char *inbuf, const char *what, /* Add a trailing '>' to email, since map_user returns plain emails 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 > mail && *(mailpos-1) != '>') { *mailpos = '>'; *(mailpos+1) = '\0'; } but it feels like the fix should go into map_user. I tried a few things, like "git log -1 --format=%aE", and couldn't find other code paths with this problem. So presumably they are all feeding email addresses without the closing ">" (so one option is to just say "map_user needs to get NUL-terminated strings). -Peff -- 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