{"thread":{"id":"18661","subject":"[PATCH] Mailmap: Allow empty email addresses to be mapped","startedAt":"2009-03-31T15:30:39Z","lastAt":"2009-04-06T19:28:48Z","messageCount":7,"participants":["Björn Steinbrink","Santi Béjar","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110017","messageId":"20090331153039.GA1520@atjola.homenet","threadId":"18661","inReplyTo":null,"subject":"[PATCH] Mailmap: Allow empty email addresses to be mapped","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-03-31T15:30:39Z","receivedAt":"2009-03-31T15:30:39Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"While it makes no sense to map some email address to an empty one, doing\nthings the other way around can be useful. For example when using\nfilter-branch with an env-filter that employs a mailmap to fix up an\nimport that created such broken commits with empty email addresses.\n\nSigned-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n---\n mailmap.c |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/mailmap.c b/mailmap.c\nindex f12bb45..654c629 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -90,7 +90,8 @@ static void add_mapping(struct string_list *map,\n \t\t old_name, old_email, new_name, new_email);\n }\n \n-static char *parse_name_and_email(char *buffer, char **name, char **email)\n+static char *parse_name_and_email(char *buffer, char **name,\n+\t\tchar **email, int allow_empty_email)\n {\n \tchar *left, *right, *nstart, *nend;\n \t*name = *email = 0;\n@@ -99,7 +100,7 @@ static char *parse_name_and_email(char *buffer, char **name, char **email)\n \t\treturn NULL;\n \tif ((right = strchr(left+1, '>')) == NULL)\n \t\treturn NULL;\n-\tif (left+1 == right)\n+\tif (!allow_empty_email && (left+1 == right))\n \t\treturn NULL;\n \n \t/* remove whitespace from beginning and end of name */\n@@ -150,8 +151,8 @@ static int read_single_mailmap(struct string_list *map, const char *filename, ch\n \t\t\t}\n \t\t\tcontinue;\n \t\t}\n-\t\tif ((name2 = parse_name_and_email(buffer, &name1, &email1)) != NULL)\n-\t\t\tparse_name_and_email(name2, &name2, &email2);\n+\t\tif ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)\n+\t\t\tparse_name_and_email(name2, &name2, &email2, 1);\n \n \t\tif (email1)\n \t\t\tadd_mapping(map, name1, email1, name2, email2);\n-- \n1.6.2.1.425.ga9a94\n"},{"id":"110557","messageId":"20090406114618.GF20356@atjola.homenet","threadId":"18661","inReplyTo":"20090331153039.GA1520@atjola.homenet","subject":"Broken umlaut in my name, again","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-04-06T11:46:18Z","receivedAt":"2009-04-06T11:46:18Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n> While it makes no sense to map some email address to an empty one, doing\n> things the other way around can be useful. For example when using\n> filter-branch with an env-filter that employs a mailmap to fix up an\n> import that created such broken commits with empty email addresses.\n> \n> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n\nThe umlaut (ö) in my name is broken in the commit that made it into\ngit.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n\nLast time this happened when I used format-patch -s instead of commit -s\nIIRC. But since then, I pay attention to do the sign-off via commit -s,\nyet my name is broken again. What did I do wrong this time?\n\nBjörn\n"},{"id":"110563","messageId":"adf1fd3d0904060546j6c2fbba9r75829f2bd383458b@mail.gmail.com","threadId":"18661","inReplyTo":"20090406114618.GF20356@atjola.homenet","subject":"Re: Broken umlaut in my name, again","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-04-06T12:46:43Z","receivedAt":"2009-04-06T12:46:43Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/4/6 Björn Steinbrink <B.Steinbrink@gmx.de>:\n> On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n>> While it makes no sense to map some email address to an empty one, doing\n>> things the other way around can be useful. For example when using\n>> filter-branch with an env-filter that employs a mailmap to fix up an\n>> import that created such broken commits with empty email addresses.\n>>\n>> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n>\n> The umlaut (ö) in my name is broken in the commit that made it into\n> git.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n>\n> Last time this happened when I used format-patch -s instead of commit -s\n> IIRC. But since then, I pay attention to do the sign-off via commit -s,\n> yet my name is broken again. What did I do wrong this time?\n\nI don't see nothing wrong in your mails. It appears to be a double\nconversion to UTF-8 between the mail and the commit.\n\nBut I always use format-patch -s without problems, what was your\nproblem with format-patch?\n\nSanti\n"},{"id":"110570","messageId":"20090406131747.GH20356@atjola.homenet","threadId":"18661","inReplyTo":"adf1fd3d0904060546j6c2fbba9r75829f2bd383458b@mail.gmail.com","subject":"Re: Broken umlaut in my name, again","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-04-06T13:17:47Z","receivedAt":"2009-04-06T13:17:47Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.04.06 14:46:43 +0200, Santi Béjar wrote:\n> 2009/4/6 Björn Steinbrink <B.Steinbrink@gmx.de>:\n> > On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n> >> While it makes no sense to map some email address to an empty one, doing\n> >> things the other way around can be useful. For example when using\n> >> filter-branch with an env-filter that employs a mailmap to fix up an\n> >> import that created such broken commits with empty email addresses.\n> >>\n> >> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n> >\n> > The umlaut (ö) in my name is broken in the commit that made it into\n> > git.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n> >\n> > Last time this happened when I used format-patch -s instead of commit -s\n> > IIRC. But since then, I pay attention to do the sign-off via commit -s,\n> > yet my name is broken again. What did I do wrong this time?\n> \n> I don't see nothing wrong in your mails. It appears to be a double\n> conversion to UTF-8 between the mail and the commit.\n> \n> But I always use format-patch -s without problems, what was your\n> problem with format-patch?\n\nI don't recall the exact problem, and I can't find the mails anymore,\nthe IIRC it was something about Content-type being generated from the\noriginal commit message, and only afterwards the sign-off line got\nadded, or something like that. That causes the Content-type to say\nascii, although the sign-off had UTF-8 in it. Or something like that.\nMight very well have been fixed since then (it was almost 2 years ago\nthat I hit that bug IIRC), but it made me stick to commit -s ;-)\n\nBjörn\n"},{"id":"110573","messageId":"adf1fd3d0904060640k3fcac0d5oc09dde7ebd430231@mail.gmail.com","threadId":"18661","inReplyTo":"20090406131747.GH20356@atjola.homenet","subject":"Re: Broken umlaut in my name, again","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-04-06T13:40:35Z","receivedAt":"2009-04-06T13:40:35Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/4/6 Björn Steinbrink <B.Steinbrink@gmx.de>:\n> On 2009.04.06 14:46:43 +0200, Santi Béjar wrote:\n>> 2009/4/6 Björn Steinbrink <B.Steinbrink@gmx.de>:\n>> > On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n>> >> While it makes no sense to map some email address to an empty one, doing\n>> >> things the other way around can be useful. For example when using\n>> >> filter-branch with an env-filter that employs a mailmap to fix up an\n>> >> import that created such broken commits with empty email addresses.\n>> >>\n>> >> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n>> >\n>> > The umlaut (ö) in my name is broken in the commit that made it into\n>> > git.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n>> >\n>> > Last time this happened when I used format-patch -s instead of commit -s\n>> > IIRC. But since then, I pay attention to do the sign-off via commit -s,\n>> > yet my name is broken again. What did I do wrong this time?\n>>\n>> I don't see nothing wrong in your mails. It appears to be a double\n>> conversion to UTF-8 between the mail and the commit.\n>>\n>> But I always use format-patch -s without problems, what was your\n>> problem with format-patch?\n>\n> I don't recall the exact problem, and I can't find the mails anymore,\n> the IIRC it was something about Content-type being generated from the\n> original commit message, and only afterwards the sign-off line got\n> added, or something like that. That causes the Content-type to say\n> ascii, although the sign-off had UTF-8 in it. Or something like that.\n> Might very well have been fixed since then\n\nYes, it is fixed (at least what you described).\n\n> (it was almost 2 years ago\n> that I hit that bug IIRC),\n\nUf! half an eternity in git scale ;-)\n\nSanti\n"},{"id":"110602","messageId":"20090406164732.GA11724@sigill.intra.peff.net","threadId":"18661","inReplyTo":"20090406114618.GF20356@atjola.homenet","subject":"Re: Broken umlaut in my name, again","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-04-06T16:47:33Z","receivedAt":"2009-04-06T16:47:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 06, 2009 at 01:46:18PM +0200, Björn Steinbrink wrote:\n\n> On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n> > While it makes no sense to map some email address to an empty one, doing\n> > things the other way around can be useful. For example when using\n> > filter-branch with an env-filter that employs a mailmap to fix up an\n> > import that created such broken commits with empty email addresses.\n> > \n> > Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n> \n> The umlaut (ö) in my name is broken in the commit that made it into\n> git.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n\nThe mail you sent that presumably became 5288dd58 looks fine (both the\nFrom and body are properly marked as iso8859-1), and \"git am\" applies it\ncorrectly here. I wonder if Junio did something unusual while applying.\n\n-Peff\n"},{"id":"110622","messageId":"20090406192848.GJ20356@atjola.homenet","threadId":"18661","inReplyTo":"20090406164732.GA11724@sigill.intra.peff.net","subject":"Re: Broken umlaut in my name, again","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-04-06T19:28:48Z","receivedAt":"2009-04-06T19:28:48Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.04.06 12:47:33 -0400, Jeff King wrote:\n> On Mon, Apr 06, 2009 at 01:46:18PM +0200, Björn Steinbrink wrote:\n> \n> > On 2009.03.31 17:30:39 +0200, Björn Steinbrink wrote:\n> > > While it makes no sense to map some email address to an empty one, doing\n> > > things the other way around can be useful. For example when using\n> > > filter-branch with an env-filter that employs a mailmap to fix up an\n> > > import that created such broken commits with empty email addresses.\n> > > \n> > > Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n> > \n> > The umlaut (ö) in my name is broken in the commit that made it into\n> > git.git --> 5288dd58356e53d61e2b3804fc7d8d23c3a46ab3\n> \n> The mail you sent that presumably became 5288dd58 looks fine (both the\n> >From and body are properly marked as iso8859-1), and \"git am\" applies it\n> correctly here. I wonder if Junio did something unusual while applying.\n\nHm, ok, so I take it that it wasn't me who broke things. Then I'm\nalready happy. I don't care much about my name being messed up, but just\nwanted to make sure that it wasn't my fault.\n\nThanks,\nBjörn\n"}]}