git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Marius Storm-Olsen <marius@trolltech.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH] Mailmap: Allow empty email addresses to be mapped
Date: Tue, 31 Mar 2009 17:30:39 +0200	[thread overview]
Message-ID: <20090331153039.GA1520@atjola.homenet> (raw)

While it makes no sense to map some email address to an empty one, doing
things the other way around can be useful. For example when using
filter-branch with an env-filter that employs a mailmap to fix up an
import that created such broken commits with empty email addresses.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
---
 mailmap.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mailmap.c b/mailmap.c
index f12bb45..654c629 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -90,7 +90,8 @@ static void add_mapping(struct string_list *map,
 		 old_name, old_email, new_name, new_email);
 }
 
-static char *parse_name_and_email(char *buffer, char **name, char **email)
+static char *parse_name_and_email(char *buffer, char **name,
+		char **email, int allow_empty_email)
 {
 	char *left, *right, *nstart, *nend;
 	*name = *email = 0;
@@ -99,7 +100,7 @@ static char *parse_name_and_email(char *buffer, char **name, char **email)
 		return NULL;
 	if ((right = strchr(left+1, '>')) == NULL)
 		return NULL;
-	if (left+1 == right)
+	if (!allow_empty_email && (left+1 == right))
 		return NULL;
 
 	/* remove whitespace from beginning and end of name */
@@ -150,8 +151,8 @@ static int read_single_mailmap(struct string_list *map, const char *filename, ch
 			}
 			continue;
 		}
-		if ((name2 = parse_name_and_email(buffer, &name1, &email1)) != NULL)
-			parse_name_and_email(name2, &name2, &email2);
+		if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)
+			parse_name_and_email(name2, &name2, &email2, 1);
 
 		if (email1)
 			add_mapping(map, name1, email1, name2, email2);
-- 
1.6.2.1.425.ga9a94

             reply	other threads:[~2009-03-31 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 15:30 Björn Steinbrink [this message]
2009-04-06 11:46 ` Broken umlaut in my name, again Björn Steinbrink
2009-04-06 12:46   ` Santi Béjar
2009-04-06 13:17     ` Björn Steinbrink
2009-04-06 13:40       ` Santi Béjar
2009-04-06 16:47   ` Jeff King
2009-04-06 19:28     ` Björn Steinbrink

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=20090331153039.GA1520@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=marius@trolltech.com \
    /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).