{"thread":{"id":"30929","subject":"Apostrophe at the end of author name","startedAt":"2012-06-29T12:41:22Z","lastAt":"2012-06-29T19:59:18Z","messageCount":8,"participants":["Kacper Kornet","Robin H. Johnson","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194435","messageId":"20120629124122.GG1258@camk.edu.pl","threadId":"30929","inReplyTo":null,"subject":"Apostrophe at the end of author name","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2012-06-29T12:41:22Z","receivedAt":"2012-06-29T12:41:22Z","isPatch":false,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"I try to import some repositories into git and one of the developers has\nasked his name to be presented as: Name 'Nick' <email>.\nHowever git commit --author=\"Name 'Nick' <email>\" strips the last\napostrophe and produces a commit authored by: Name 'Nick <email>.\n\nMaybe the function  strbuf_addstr_without_crud in ident.c should strip\nthe trailing apostrophe only when it removed it also from the beginning\nof the string?\n\n-- \n  Kacper\n"},{"id":"194436","messageId":"robbat2-20120629T170457-788694600Z@orbis-terrarum.net","threadId":"30929","inReplyTo":"20120629124122.GG1258@camk.edu.pl","subject":"Re: Apostrophe at the end of author name","fromName":"Robin H. Johnson","fromEmail":"robbat2@gentoo.org","sentAt":"2012-06-29T17:05:31Z","receivedAt":"2012-06-29T17:05:31Z","isPatch":false,"sender":{"key":"robbat2@gentoo.org","avatar":"https://avatars.githubusercontent.com/u/373898?v=4"},"body":"On Fri, Jun 29, 2012 at 02:41:22PM +0200,  Kacper Kornet wrote:\n> I try to import some repositories into git and one of the developers has\n> asked his name to be presented as: Name 'Nick' <email>.\n> However git commit --author=\"Name 'Nick' <email>\" strips the last\n> apostrophe and produces a commit authored by: Name 'Nick <email>.\n> \n> Maybe the function  strbuf_addstr_without_crud in ident.c should strip\n> the trailing apostrophe only when it removed it also from the beginning\n> of the string?\nWhich version of Git? And is it being stripped by git, or one of the\nimport tools?\n\n-- \nRobin Hugh Johnson\nGentoo Linux: Developer, Trustee & Infrastructure Lead\nE-Mail     : robbat2@gentoo.org\nGnuPG FP   : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85\n"},{"id":"194438","messageId":"20120629174358.GB3804@sigill.intra.peff.net","threadId":"30929","inReplyTo":"robbat2-20120629T170457-788694600Z@orbis-terrarum.net","subject":"Re: Apostrophe at the end of author name","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-06-29T17:43:58Z","receivedAt":"2012-06-29T17:43:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 29, 2012 at 05:05:31PM +0000, Robin H. Johnson wrote:\n\n> On Fri, Jun 29, 2012 at 02:41:22PM +0200,  Kacper Kornet wrote:\n> > I try to import some repositories into git and one of the developers has\n> > asked his name to be presented as: Name 'Nick' <email>.\n> > However git commit --author=\"Name 'Nick' <email>\" strips the last\n> > apostrophe and produces a commit authored by: Name 'Nick <email>.\n> > \n> > Maybe the function  strbuf_addstr_without_crud in ident.c should strip\n> > the trailing apostrophe only when it removed it also from the beginning\n> > of the string?\n> Which version of Git? And is it being stripped by git, or one of the\n> import tools?\n\nI'm sure it's the most recent one, as strbuf_addstr_without_crud was\nonly added recently (but it is a refactoring of older code which should\nhave the same behavior). We had a similar complaint recently that\n\"A.B.C. <abc@example.com>\" has its trailing dot stripped, even though\nthe internal ones are retained.\n\nThose stripping rules date back to very early versions of git to try to\nclean up cruft from gecos or other unreliable sources. I wonder if we\nare better off being a bit more liberal.\n\n-Peff\n"},{"id":"194440","messageId":"20120629181701.GB6533@camk.edu.pl","threadId":"30929","inReplyTo":"20120629174358.GB3804@sigill.intra.peff.net","subject":"Re: Apostrophe at the end of author name","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2012-06-29T18:17:01Z","receivedAt":"2012-06-29T18:17:01Z","isPatch":false,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"On Fri, Jun 29, 2012 at 01:43:58PM -0400, Jeff King wrote:\n> On Fri, Jun 29, 2012 at 05:05:31PM +0000, Robin H. Johnson wrote:\n\n> > On Fri, Jun 29, 2012 at 02:41:22PM +0200,  Kacper Kornet wrote:\n> > > I try to import some repositories into git and one of the developers has\n> > > asked his name to be presented as: Name 'Nick' <email>.\n> > > However git commit --author=\"Name 'Nick' <email>\" strips the last\n> > > apostrophe and produces a commit authored by: Name 'Nick <email>.\n\n> > > Maybe the function  strbuf_addstr_without_crud in ident.c should strip\n> > > the trailing apostrophe only when it removed it also from the beginning\n> > > of the string?\n> > Which version of Git? And is it being stripped by git, or one of the\n> > import tools?\n\n> I'm sure it's the most recent one,\n\nYes, it is 1.7.11\n\n>  as strbuf_addstr_without_crud was\n> only added recently (but it is a refactoring of older code which should\n> have the same behavior).\n\nIt depends what you call recently. It was refactored in July 2005\n(commit: 6aa33f4035d5). But it looks like the previous code (before\nrefactoring) removed only comma, dot and semicolon from the end of the\nauthor name.\n\n-- \n  Kacper\n"},{"id":"194442","messageId":"20120629182944.GA20346@sigill.intra.peff.net","threadId":"30929","inReplyTo":"20120629181701.GB6533@camk.edu.pl","subject":"Re: Apostrophe at the end of author name","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-06-29T18:29:44Z","receivedAt":"2012-06-29T18:29:44Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 29, 2012 at 08:17:01PM +0200, Kacper Kornet wrote:\n\n> >  as strbuf_addstr_without_crud was\n> > only added recently (but it is a refactoring of older code which should\n> > have the same behavior).\n> \n> It depends what you call recently. It was refactored in July 2005\n> (commit: 6aa33f4035d5). But it looks like the previous code (before\n> refactoring) removed only comma, dot and semicolon from the end of the\n> author name.\n\nI meant the name strbuf_addstr_without_crud did not exist until I added\nit in c96f0c8, about a month ago. But yes, the functionality of the code\nhas been there since the very early days.\n\nI'm tempting by the patch below, which would remove only the\nsyntactically significant meta-characters (\"\\n\", \"<\", and \">\"), as well\nas trimming any stray whitespace at the edges. The problem is that we\ndon't really have a clue how many people were relying on this trimming\nto clean up their names or emails, so there may be regressions for other\npeople.\n\ndiff --git a/ident.c b/ident.c\nindex 443c075..4552f8d 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -127,15 +127,8 @@ const char *ident_default_date(void)\n static int crud(unsigned char c)\n {\n \treturn  c <= 32  ||\n-\t\tc == '.' ||\n-\t\tc == ',' ||\n-\t\tc == ':' ||\n-\t\tc == ';' ||\n \t\tc == '<' ||\n-\t\tc == '>' ||\n-\t\tc == '\"' ||\n-\t\tc == '\\\\' ||\n-\t\tc == '\\'';\n+\t\tc == '>';\n }\n \n /*\n"},{"id":"194443","messageId":"7vd34i3pot.fsf@alter.siamese.dyndns.org","threadId":"30929","inReplyTo":"20120629182944.GA20346@sigill.intra.peff.net","subject":"Re: Apostrophe at the end of author name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-29T19:04:18Z","receivedAt":"2012-06-29T19:04:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I'm tempting by the patch below, which would remove only the\n> syntactically significant meta-characters (\"\\n\", \"<\", and \">\"), as well\n> as trimming any stray whitespace at the edges. The problem is that we\n> don't really have a clue how many people were relying on this trimming\n> to clean up their names or emails, so there may be regressions for other\n> people.\n\nWhat do you exactly mean by \"syntactically significant\"?  In other\nwords, \"whose syntax\"?\n\nThe code with the patch will leave \".\" out of the crud, so with\n\n\tspearce:*:1000:1000:Shawn O. Pearce:/home/spearce:/bin/sh\n\nwe would get:\n\n\tFrom: Shawn O. Pearce <spearce@spearce.org>\n\nwithout dropping the \".\" in the name.  Your MTA would likely to\nreject it.\n\nI think that quoting \"syntactically significant meta-characters\" in\nthe context of e-mail headers is a job for the MSA, and the human\nreadable names in GIT_AUTHOR_NAME should allow any reasonable\ncharacter.  And I agree that it is a sane definition of \"reasonable\"\nto exclude \"\\n\", \"<\", and \">\" (and nothing else), as they are the\nonly \"syntactically significant\" in the context of commit object\nheader.\n\nThe patch goes in the right direction in that sense, but you need to\nmake sure that git-send-email and git-imap-send (the only two MSA we\nship) do the right thing when fed names with \".\", dq, etc. first.\n\n> diff --git a/ident.c b/ident.c\n> index 443c075..4552f8d 100644\n> --- a/ident.c\n> +++ b/ident.c\n> @@ -127,15 +127,8 @@ const char *ident_default_date(void)\n>  static int crud(unsigned char c)\n>  {\n>  \treturn  c <= 32  ||\n> -\t\tc == '.' ||\n> -\t\tc == ',' ||\n> -\t\tc == ':' ||\n> -\t\tc == ';' ||\n>  \t\tc == '<' ||\n> -\t\tc == '>' ||\n> -\t\tc == '\"' ||\n> -\t\tc == '\\\\' ||\n> -\t\tc == '\\'';\n> +\t\tc == '>';\n>  }\n>  \n>  /*\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"194444","messageId":"20120629193504.GA11823@sigill.intra.peff.net","threadId":"30929","inReplyTo":"7vd34i3pot.fsf@alter.siamese.dyndns.org","subject":"Re: Apostrophe at the end of author name","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-06-29T19:35:05Z","receivedAt":"2012-06-29T19:35:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 29, 2012 at 12:04:18PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > I'm tempting by the patch below, which would remove only the\n> > syntactically significant meta-characters (\"\\n\", \"<\", and \">\"), as well\n> > as trimming any stray whitespace at the edges. The problem is that we\n> > don't really have a clue how many people were relying on this trimming\n> > to clean up their names or emails, so there may be regressions for other\n> > people.\n> \n> What do you exactly mean by \"syntactically significant\"?  In other\n> words, \"whose syntax\"?\n\nI meant syntactically significant to git's ident lines. I.e., \"<\", \">\",\nand \"\\n\". If the identities are going to be put somewhere else with\ndifferent syntax (e.g., an rfc822 header), then they would obviously\nneed to be quoted (and that is no different than the current state), but\nthat should happen elsewhere.\n\n> The code with the patch will leave \".\" out of the crud, so with\n> \n> \tspearce:*:1000:1000:Shawn O. Pearce:/home/spearce:/bin/sh\n> \n> we would get:\n> \n> \tFrom: Shawn O. Pearce <spearce@spearce.org>\n> \n> without dropping the \".\" in the name.  Your MTA would likely to\n> reject it.\n\nBut that is already the case. The crud() function is checked only for\nthe beginning and end of each item. Which is why you get senseless\noutcomes like \"A.B.C.\" turning into \"A.B.C\". AFAICT, the motivation for\nmost items in the crud function is purely about \"this is junk that we\nmight find in a gecos field and should be stripped to make the name\nprettier\". I.e., they are heuristics, and we now have two reports of\nthose heuristics being wrong.\n\nMy concern is that those heuristics are sometimes _right_, and are\nhelping people. But we don't know how often, and I suspect there is no\nway to know without changing it and waiting for people to scream, which\ndoes not excite me.\n\nThe only example I could come up with by thinking is that we probably\n_do_ want to strip a trailing dot from an email address (e.g., some\npeople will express a hostname as \"example.com.\" to indicate that it is\nfully qualified, but it is typically omitted from an email address).\nHandling that would involve splitting the heuristics for names and\nemails.\n\n> I think that quoting \"syntactically significant meta-characters\" in\n> the context of e-mail headers is a job for the MSA, and the human\n> readable names in GIT_AUTHOR_NAME should allow any reasonable\n> character.  And I agree that it is a sane definition of \"reasonable\"\n> to exclude \"\\n\", \"<\", and \">\" (and nothing else), as they are the\n> only \"syntactically significant\" in the context of commit object\n> header.\n> \n> The patch goes in the right direction in that sense, but you need to\n> make sure that git-send-email and git-imap-send (the only two MSA we\n> ship) do the right thing when fed names with \".\", dq, etc. first.\n\nActually, it is format-patch where the quoting should go, as it is the\nthing that puts the ident in the rfc822 header. And indeed, it already\ndoes so (as it must, because we _do_ allow \".\" as in \"Shawn O. Pearce\",\nand have always done so).\n\n-Peff\n"},{"id":"194445","messageId":"20120629195918.GB9403@camk.edu.pl","threadId":"30929","inReplyTo":"20120629182944.GA20346@sigill.intra.peff.net","subject":"Re: Apostrophe at the end of author name","fromName":"Kacper Kornet","fromEmail":"kornet@camk.edu.pl","sentAt":"2012-06-29T19:59:18Z","receivedAt":"2012-06-29T19:59:18Z","isPatch":false,"sender":{"key":"kornet@camk.edu.pl","avatar":null},"body":"On Fri, Jun 29, 2012 at 02:29:44PM -0400, Jeff King wrote:\n> On Fri, Jun 29, 2012 at 08:17:01PM +0200, Kacper Kornet wrote:\n\n> > >  as strbuf_addstr_without_crud was\n> > > only added recently (but it is a refactoring of older code which should\n> > > have the same behavior).\n\n> > It depends what you call recently. It was refactored in July 2005\n> > (commit: 6aa33f4035d5). But it looks like the previous code (before\n> > refactoring) removed only comma, dot and semicolon from the end of the\n> > author name.\n\n> I meant the name strbuf_addstr_without_crud did not exist until I added\n> it in c96f0c8, about a month ago. But yes, the functionality of the code\n> has been there since the very early days.\n\n> I'm tempting by the patch below, which would remove only the\n> syntactically significant meta-characters (\"\\n\", \"<\", and \">\"), as well\n> as trimming any stray whitespace at the edges. The problem is that we\n> don't really have a clue how many people were relying on this trimming\n> to clean up their names or emails, so there may be regressions for other\n> people.\n\nSo maybe the option to enable/disable the old behaviour should be added.\n\n-- \n  Kacper\n"}]}