From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Felipe Contreras" <felipe.contreras@gmail.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [bug] blame duplicates trailing ">" in mailmapped emails
Date: Sun, 05 Feb 2012 13:38:19 -0800 [thread overview]
Message-ID: <7vipjlezas.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 7v39aphw85.fsf@alter.siamese.dyndns.org
Junio C Hamano <gitster@pobox.com> writes:
> Jeff King <peff@peff.net> writes:
> ...
>> but it feels like the fix should go into map_user.
>
> Thanks.
>
> The map_user() API takes an email address that is terminated by either NUL
> or '>' to allow the caller to learn the corresponding up-to-date email
> address that is NUL terminated, while indicating with its return value
> that if the caller even needs to replace what it already has. But the
> function does not properly terminate email when it only touched the name
> part. And I think that is the real bug.
And the gist of the patch to fix the bug would look like this two liner.
In the real fix, "p" should be renamed to "end_of_email" or something
descriptive like that.
I only made sure that this fixes the original case of the email address of
Shawn reported by Felipe, but other than that like everything else I send
here with "... would look like this", not tested beyond "it compiles".
But conceptually it looks correct (famous last words ;-).
Felipe, does it pass your test cases?
mailmap.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/mailmap.c b/mailmap.c
index 8c3196c..ce805fa 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -236,6 +236,8 @@ int map_user(struct string_list *map,
}
if (maxlen_email && mi->email)
strlcpy(email, mi->email, maxlen_email);
+ else
+ *p = '\0';
if (maxlen_name && mi->name)
strlcpy(name, mi->name, maxlen_name);
debug_mm("map_user: to '%s' <%s>\n", name, mi->email ? mi->email : "");
next prev parent reply other threads:[~2012-02-05 21:38 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 1:15 [PATCH v3 0/4] completion: couple of cleanups Felipe Contreras
[not found] ` <1328145320-14071-2-git-send-email-felipe.contreras@gmail.com>
2012-02-02 8:16 ` [PATCH v3 1/4] completion: be nicer with zsh Jonathan Nieder
2012-02-02 8:34 ` Felipe Contreras
2012-02-02 9:10 ` Jonathan Nieder
2012-02-02 9:38 ` Felipe Contreras
2012-02-02 9:46 ` Jonathan Nieder
2012-02-02 10:18 ` Felipe Contreras
2012-02-02 8:48 ` Jonathan Nieder
2012-02-02 10:12 ` Felipe Contreras
2012-02-02 10:35 ` Thomas Rast
2012-02-02 10:50 ` Jonathan Nieder
2012-02-02 10:55 ` Jonathan Nieder
2012-02-02 11:00 ` Felipe Contreras
2012-02-02 19:27 ` Junio C Hamano
2012-02-02 20:45 ` Felipe Contreras
2012-02-03 0:17 ` Junio C Hamano
2012-02-03 10:38 ` Felipe Contreras
2012-02-03 20:28 ` Junio C Hamano
2012-02-04 15:46 ` Felipe Contreras
2012-02-04 18:26 ` [bug] blame duplicates trailing ">" in mailmapped emails Jeff King
2012-02-04 19:30 ` Felipe Contreras
2012-02-04 23:20 ` Jeff King
2012-02-05 21:11 ` Felipe Contreras
2012-02-05 23:50 ` Jeff King
2012-02-05 20:16 ` Junio C Hamano
2012-02-05 21:38 ` Junio C Hamano [this message]
2012-02-05 23:47 ` Jeff King
2012-02-06 0:39 ` Junio C Hamano
2012-02-06 3:03 ` Jeff King
2012-02-06 3:13 ` Junio C Hamano
2012-02-06 3:16 ` Junio C Hamano
2012-02-06 4:01 ` Jeff King
2012-02-06 12:14 ` Felipe Contreras
2012-02-06 22:04 ` Junio C Hamano
2012-02-06 23:11 ` Felipe Contreras
2012-02-05 20:49 ` [PATCH v3 1/4] completion: be nicer with zsh Junio C Hamano
2012-02-02 9:05 ` [PATCH v3 2/4] completion: simplify __git_remotes Jonathan Nieder
2012-02-02 19:48 ` [PATCH v3 0/4] completion: couple of cleanups Junio C Hamano
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=7vipjlezas.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=szeder@ira.uka.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.