summaryrefslogtreecommitdiff
path: root/mailmap.c
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2009-03-31 17:30:39 +0200
committerJunio C Hamano <gitster@pobox.com>2009-04-01 15:53:36 -0700
commit5288dd58356e53d61e2b3804fc7d8d23c3a46ab3 (patch)
tree8442c682ec805f3f1df62404472ae3d887e3b7be /mailmap.c
parent75fd877e150ecca74f9749bfd6bfa9a6b425ab57 (diff)
downloadgit-5288dd58356e53d61e2b3804fc7d8d23c3a46ab3.tar.gz
Mailmap: Allow empty email addresses to be mapped
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailmap.c')
-rw-r--r--mailmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mailmap.c b/mailmap.c
index f12bb45a3f..654c6295cb 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);