{"thread":{"id":"20254","subject":"Add option in git-am to ignore leading text?","startedAt":"2009-07-28T03:13:58Z","lastAt":"2009-07-28T19:19:17Z","messageCount":7,"participants":["Frans Pop","Nicolas Sebrecht","Mark Brown"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"118919","messageId":"200907280513.59374.elendil@planet.nl","threadId":"20254","inReplyTo":null,"subject":"Add option in git-am to ignore leading text?","fromName":"Frans Pop","fromEmail":"elendil@planet.nl","sentAt":"2009-07-28T03:13:58Z","receivedAt":"2009-07-28T03:13:58Z","isPatch":false,"sender":{"key":"elendil@planet.nl","avatar":null},"body":"The git-am manpage currently says:\n  The body of the message (iow, after a blank line that terminates RFC2822\n  headers) can begin with \"Subject:\" and \"From:\" lines that are different\n  from those of the mail header, to override the values of these fields.\n\nThat's a very useful feature. However, on lkml there are frequently also \nmails with the following structure (example: [1]).\n\n<example>\n[Regular mail headers, including From: and Subject:]\n\n[Comments, quotes from previous messages, or some introduction]\n\nFrom: [email address]\nSubject: [patch short description]\n[patch long description]\n\n[patch diff]\n</example>\n\nHere the overruling pseudo-headers are not at the beginning of the \nmessage, which results in all the leading comments getting included in \nthe commit log and those have to be cleaned manually.\n\nWould it be possible to add an option to git-am to \"reset\" the commit log \nwhen it encounters either a From: or Subject: pseudo header, so that only \nthe intended patch short and long descriptions are used for the commit \nlog?\n\nOr is this already possible somehow?\n\nCheers,\nFJP\n\n[1] http://lkml.org/lkml/2009/7/10/49\n"},{"id":"118962","messageId":"20090728142219.GA16168@vidovic","threadId":"20254","inReplyTo":"200907280513.59374.elendil@planet.nl","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2009-07-28T14:22:19Z","receivedAt":"2009-07-28T14:22:19Z","isPatch":false,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 28/07/09, Frans Pop wrote:\n> \n> That's a very useful feature. However, on lkml there are frequently also \n> mails with the following structure (example: [1]).\n> \n> [1] http://lkml.org/lkml/2009/7/10/49\n\nThis is an example of what not to do. Content after the '---' won't be\npart of the commit message.\n\n  $ man git-am\n  <snip>\n\tThe commit message is formed by the title taken from the \"Subject: \",\n  a blank line and the body of the message up to where the patch begins.\n  Excess whitespace at the end of each line is automatically stripped.\n\n  The patch is expected to be inline, directly following the\n  message. Any line that is of the form:\n   ·   three-dashes and end-of-line, or\n   ·   a line that begins with \"diff -\", or\n   ·   a line that begins with \"Index: \"\n  is taken as the beginning of a patch, and the commit log message\n  is terminated before the first occurrence of such a line.\n  <snip>\n\n> <example>\n> [Regular mail headers, including From: and Subject:]\n> \n> [Comments, quotes from previous messages, or some introduction]\n> \n> From: [email address]\n> Subject: [patch short description]\n> [patch long description]\n> \n> [patch diff]\n> </example>\n> \n> Here the overruling pseudo-headers are not at the beginning of the \n> message, which results in all the leading comments getting included in \n> the commit log and those have to be cleaned manually.\n> \n> Would it be possible to add an option to git-am to \"reset\" the commit log \n> when it encounters either a From: or Subject: pseudo header, so that only \n> the intended patch short and long descriptions are used for the commit \n> log?\n\nIMHO, a better way would be to ignore lines beginning with a defined\nlevel of quotes in the commit message (the \"level\" beeing the number of\n'>' or '> ' found at the beginning of a line. Something like\n\n\t--strip-quotes[=N]\n\nwhere N is the level of quoted lines to remove (if \"=N\" is\nnot given, assume that the level is 1 and remove all the quotes).\n\nComments?\n\n-- \nNicolas Sebrecht\n"},{"id":"118963","messageId":"20090728143149.GA3013@sirena.org.uk","threadId":"20254","inReplyTo":"20090728142219.GA16168@vidovic","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Mark Brown","fromEmail":"broonie@opensource.wolfsonmicro.com","sentAt":"2009-07-28T14:31:49Z","receivedAt":"2009-07-28T14:31:49Z","isPatch":false,"sender":{"key":"broonie@opensource.wolfsonmicro.com","avatar":"https://gravatar.com/avatar/5fb25e4e0de3255caa21123e2b518c314d26245069221ff55910d5c6ba3343c4?d=mp&s=160"},"body":"On Tue, Jul 28, 2009 at 04:22:19PM +0200, Nicolas Sebrecht wrote:\n\n> IMHO, a better way would be to ignore lines beginning with a defined\n> level of quotes in the commit message (the \"level\" beeing the number of\n> '>' or '> ' found at the beginning of a line. Something like\n\n> \t--strip-quotes[=N]\n\n> where N is the level of quoted lines to remove (if \"=N\" is\n> not given, assume that the level is 1 and remove all the quotes).\n\n> Comments?\n\nThat would help but it'll still carry over at least part of the\ndiscussion that preceeds the patch (normally the person sending the\npatch will say something as well as including the patch) and it won't\npick up things like the subject line without some manual fixing.\n"},{"id":"118973","messageId":"200907281938.24960.elendil@planet.nl","threadId":"20254","inReplyTo":"20090728142219.GA16168@vidovic","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Frans Pop","fromEmail":"elendil@planet.nl","sentAt":"2009-07-28T17:38:24Z","receivedAt":"2009-07-28T17:38:24Z","isPatch":false,"sender":{"key":"elendil@planet.nl","avatar":null},"body":"On Tuesday 28 July 2009, Nicolas Sebrecht wrote:\n> The 28/07/09, Frans Pop wrote:\n> > That's a very useful feature. However, on lkml there are frequently\n> > also mails with the following structure (example: [1]).\n> >\n> > [1] http://lkml.org/lkml/2009/7/10/49\n>\n> This is an example of what not to do. Content after the '---' won't be\n> part of the commit message.\n\nYes, I'm aware of that (and I omitted such a line from my example for that \nreason). But currently that's not really relevant as either with or \nwithout that line one needs to manually fix up things before the desired \nresult is obtained.\n\nIf my feature request is implemented I'll of course make sure to omit the\n'---' line if needed.\n\nHere are some other examples (some of which would equally need to drop or \nchange a separator line).\nhttp://lkml.org/lkml/2009/6/25/62\nhttp://lkml.org/lkml/2009/6/22/114\nhttp://lkml.org/lkml/2009/6/30/109\nhttp://lkml.org/lkml/2009/6/30/224\n\n> IMHO, a better way would be to ignore lines beginning with a defined\n> level of quotes in the commit message (the \"level\" beeing the number of\n> '>' or '> ' found at the beginning of a line. Something like\n>\n> \t--strip-quotes[=N]\n>\n> where N is the level of quoted lines to remove (if \"=N\" is\n> not given, assume that the level is 1 and remove all the quotes).\n\nAs Mark Brown has already said, that won't solve the issue for an \nintroduction or comments added by the sender of the mail.\nAlso, people use all kinds of quoting schemes, not just leading \">\".\n\nAnd I've also seen plenty of cases where quoted lines _were_ a desired \npart of a commit log.\n\nThanks,\nFJP\n"},{"id":"118978","messageId":"20090728181524.GC16168@vidovic","threadId":"20254","inReplyTo":"200907281938.24960.elendil@planet.nl","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2009-07-28T18:15:24Z","receivedAt":"2009-07-28T18:15:24Z","isPatch":false,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 28/07/09, Frans Pop wrote:\n> On Tuesday 28 July 2009, Nicolas Sebrecht wrote:\n> \n> If my feature request is implemented I'll of course make sure to omit the\n> '---' line if needed.\n\nThis is already done.\n\n> Here are some other examples (some of which would equally need to drop or \n> change a separator line).\n> http://lkml.org/lkml/2009/6/25/62\n\nUses \"From:\", \"Date:\", and \"Subject:\".\n\n> http://lkml.org/lkml/2009/6/22/114\n\nUses \"From:\" and \"Subject:\".\n\n> http://lkml.org/lkml/2009/6/30/109\n\nUses \"Subject:\" only.\n\nI guess there are as results as contributors but it could be possible to\nadd some rules to the format. This could ending up with an unuseable\nfeature in practice, though. I don't know.\n\n> http://lkml.org/lkml/2009/6/30/224\n\nBroken link ?\n\n> As Mark Brown has already said, that won't solve the issue for an \n> introduction or comments added by the sender of the mail.\n\nTrue.\n\n> Also, people use all kinds of quoting schemes, not just leading \">\".\n\nAnd people don't use the same rules with the \"inline headers\" too. :-)\n\n> And I've also seen plenty of cases where quoted lines _were_ a desired \n> part of a commit log.\n\nYes, that's why it's an _option_.\n\n-- \nNicolas Sebrecht\n"},{"id":"118979","messageId":"200907282111.14404.elendil@planet.nl","threadId":"20254","inReplyTo":"20090728181524.GC16168@vidovic","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Frans Pop","fromEmail":"elendil@planet.nl","sentAt":"2009-07-28T19:11:13Z","receivedAt":"2009-07-28T19:11:13Z","isPatch":false,"sender":{"key":"elendil@planet.nl","avatar":null},"body":"On Tuesday 28 July 2009, Nicolas Sebrecht wrote:\n> > Here are some other examples (some of which would equally need to\n> > drop or change a separator line).\n> > http://lkml.org/lkml/2009/6/25/62\n> Uses \"From:\", \"Date:\", and \"Subject:\".\n>\n> > http://lkml.org/lkml/2009/6/22/114\n> Uses \"From:\" and \"Subject:\".\n>\n> > http://lkml.org/lkml/2009/6/30/109\n> Uses \"Subject:\" only.\n>\n> I guess there are as results as contributors but it could be possible\n> to add some rules to the format. This could ending up with an unuseable\n> feature in practice, though. I don't know.\n\nMy proposal was \"when it encounters _either_ a From: _or_ a Subject: \npseudo header\" which would work for all examples. But I fully agree with \nyou that some rules are needed.\nWhether to do the same on Date: is less obvious, but I doubt that would \never be seen without at least one of the others (and the rules could \nspecify that).\n\n> > http://lkml.org/lkml/2009/6/30/224\n> Broken link ?\n\nWorks for me, just slow.\n\n> > And I've also seen plenty of cases where quoted lines _were_ a\n> > desired part of a commit log.\n>\n> Yes, that's why it's an _option_.\n\nIMHO it does not add much. My proposal would be more generic exactly \nbecause it defines the pseudo headers as a natural separator between \nintroduction and the part of the mail git-am should act on.\n"},{"id":"118980","messageId":"200907282119.17889.elendil@planet.nl","threadId":"20254","inReplyTo":"200907282111.14404.elendil@planet.nl","subject":"Re: Add option in git-am to ignore leading text?","fromName":"Frans Pop","fromEmail":"elendil@planet.nl","sentAt":"2009-07-28T19:19:17Z","receivedAt":"2009-07-28T19:19:17Z","isPatch":false,"sender":{"key":"elendil@planet.nl","avatar":null},"body":"On Tuesday 28 July 2009, Frans Pop wrote:\n> Whether to do the same on Date: is less obvious, but I doubt that would\n> ever be seen without at least one of the others (and the rules could\n> specify that).\n\nHmm. Is a Date: pseudo header used at all? It isn't mentioned in the \ngit-am man page, only From: and Subject: are.\n"}]}