git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/4] mailmap: do not lose single-letter names
Date: Fri, 12 Jul 2013 14:38:52 -0700	[thread overview]
Message-ID: <1373665135-32484-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1373665135-32484-1-git-send-email-gitster@pobox.com>

In parse_name_and_email() function, there is this line:

	*name = (nstart < nend ? nstart : NULL);

When the function is given a buffer "A <A@example.org> <old@x.z>",
nstart scans from the beginning of the buffer, skipping whitespaces
(there isn't any, so nstart points at the buffer), while nend starts
from one byte before the first '<' and skips whitespaces backwards
and stops at the first non-whitespace (i.e. it hits "A" at the
beginning of the buffer).  nstart == nend in this case for a
single-letter name, and an off-by-one error makes it fail to pick up
the name, which makes the entry equivalent to

	<A@example.org> <old@x.z>

without the name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 mailmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mailmap.c b/mailmap.c
index 2a7b366..418081e 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -122,7 +122,7 @@ static char *parse_name_and_email(char *buffer, char **name,
 	while (nend > nstart && isspace(*nend))
 		--nend;
 
-	*name = (nstart < nend ? nstart : NULL);
+	*name = (nstart <= nend ? nstart : NULL);
 	*email = left+1;
 	*(nend+1) = '\0';
 	*right++ = '\0';
-- 
1.8.3.2-941-gda9c3c8

  reply	other threads:[~2013-07-12 21:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 21:38 [PATCH 0/4] Microfixes to mailmap Junio C Hamano
2013-07-12 21:38 ` Junio C Hamano [this message]
2013-07-13  7:20   ` [PATCH] mailmap: Testing the single letter name case Stefan Beller
2013-07-13 17:38     ` Junio C Hamano
2013-07-13 18:14       ` Stefan Beller
2013-07-13 20:20         ` Junio C Hamano
2013-07-15  2:31           ` Eric Sunshine
2013-07-15 15:54             ` Junio C Hamano
2013-07-14  2:38     ` Eric Sunshine
2013-07-12 21:38 ` [PATCH 2/4] mailmap: do not downcase mailmap entries Junio C Hamano
2013-07-12 21:38 ` [PATCH 3/4] mailmap: style fixes Junio C Hamano
2013-07-12 21:38 ` [PATCH 4/4] add a testcase for checking case insensitivity of mailmap Junio C Hamano
2013-07-12 22:38   ` Eric Sunshine
2013-07-12 22:51   ` Eric Sunshine

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=1373665135-32484-2-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /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).