{"thread":{"id":"58888","subject":"git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","startedAt":"2022-12-02T14:20:29Z","lastAt":"2022-12-16T01:16:02Z","messageCount":7,"participants":["Vincent Lefevre","Phillip Wood","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"468433","messageId":"20221202141153.GA5599@cventin.lip.ens-lyon.fr","threadId":"58888","inReplyTo":null,"subject":"git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Vincent Lefevre","fromEmail":"vincent@vinc17.net","sentAt":"2022-12-02T14:11:53Z","receivedAt":"2022-12-02T14:20:29Z","isPatch":false,"sender":{"key":"vincent@vinc17.net","avatar":null},"body":"With git 2.38.1 under Debian, when I use \"git cherry-pick -x\"\non a commit such that the last line of the log message starts\nwith \"note:\" (case insensitively), the blank line before the\n\"cherry picked from commit\" line is missing.\n\nFor instance:\n\n    New commit\n    \n    foo\n    \n    nOtE:\n    (cherry picked from commit 3ba643e2eec4bdc1cd46b478ab36ee0707d241c2)\n\nand\n\n    New commit\n    \n    Note: foo.\n    (cherry picked from commit d0e85cdd32e30f78eeb968f275fc3a98899d791e)\n\nbut the following ones are OK:\n\n    New commit\n    \n    note:\n    foo\n    \n    (cherry picked from commit a0ffae22fd3c94210170a3addcf802804f6ee5f7)\n\n----\n\n    New commit\n    \n    A Note:\n    \n    (cherry picked from commit 0a89e0e7f8be3063803b0ad4381cd848ec52dd39)\n\n----\n\n    New commit\n    \n    Note\n    \n    (cherry picked from commit f217bd5069c9d66a8ca54c869919ff484a18d20c)\n\n----\n\nI also had reported the bug in the Debian BTS:\n\n  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1025155\n\n-- \nVincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>\n100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>\nWork: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)\n"},{"id":"468444","messageId":"75e00d43-3184-dcf8-4621-cdf02c9f7320@dunelm.org.uk","threadId":"58888","inReplyTo":"20221202141153.GA5599@cventin.lip.ens-lyon.fr","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2022-12-02T16:41:23Z","receivedAt":"2022-12-02T16:41:30Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Vincent\n\nOn 02/12/2022 14:11, Vincent Lefevre wrote:\n> With git 2.38.1 under Debian, when I use \"git cherry-pick -x\"\n> on a commit such that the last line of the log message starts\n> with \"note:\" (case insensitively), the blank line before the\n> \"cherry picked from commit\" line is missing.\n> \n> For instance:\n> \n>      New commit\n>      \n>      foo\n>      \n>      nOtE:\n>      (cherry picked from commit 3ba643e2eec4bdc1cd46b478ab36ee0707d241c2)\n\n\"git cherry-pick -x\" takes care not to add a blank line if there are \ntrailers such as Signed-off-by: at the end of the message (if it did \nthen the trailers would no longer be recognized as trailers as they \nwould not be the last paragraph). In this case the \"nOtE:\" line looks \nlike a trailer and so no blank line is added.\n\nI can see it is annoying in this case but I'm afraid I don't have any \nideas of how we could avoid it without breaking the case where the \nmessage does contain trailers.\n\nBest Wishes\n\nPhillip\n\n> and\n> \n>      New commit\n>      \n>      Note: foo.\n>      (cherry picked from commit d0e85cdd32e30f78eeb968f275fc3a98899d791e)\n> \n> but the following ones are OK:\n> \n>      New commit\n>      \n>      note:\n>      foo\n>      \n>      (cherry picked from commit a0ffae22fd3c94210170a3addcf802804f6ee5f7)\n> \n> ----\n> \n>      New commit\n>      \n>      A Note:\n>      \n>      (cherry picked from commit 0a89e0e7f8be3063803b0ad4381cd848ec52dd39)\n> \n> ----\n> \n>      New commit\n>      \n>      Note\n>      \n>      (cherry picked from commit f217bd5069c9d66a8ca54c869919ff484a18d20c)\n> \n> ----\n> \n> I also had reported the bug in the Debian BTS:\n> \n>    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1025155\n> \n"},{"id":"468449","messageId":"20221202170144.GC5599@cventin.lip.ens-lyon.fr","threadId":"58888","inReplyTo":"75e00d43-3184-dcf8-4621-cdf02c9f7320@dunelm.org.uk","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Vincent Lefevre","fromEmail":"vincent@vinc17.net","sentAt":"2022-12-02T17:01:44Z","receivedAt":"2022-12-02T17:01:54Z","isPatch":false,"sender":{"key":"vincent@vinc17.net","avatar":null},"body":"Hi Phillip,\n\nOn 2022-12-02 16:41:23 +0000, Phillip Wood wrote:\n> On 02/12/2022 14:11, Vincent Lefevre wrote:\n> > With git 2.38.1 under Debian, when I use \"git cherry-pick -x\"\n> > on a commit such that the last line of the log message starts\n> > with \"note:\" (case insensitively), the blank line before the\n> > \"cherry picked from commit\" line is missing.\n> > \n> > For instance:\n> > \n> >      New commit\n> >      foo\n> >      nOtE:\n> >      (cherry picked from commit 3ba643e2eec4bdc1cd46b478ab36ee0707d241c2)\n> \n> \"git cherry-pick -x\" takes care not to add a blank line if there are\n> trailers such as Signed-off-by: at the end of the message (if it did then\n> the trailers would no longer be recognized as trailers as they would not be\n> the last paragraph). In this case the \"nOtE:\" line looks like a trailer and\n> so no blank line is added.\n> \n> I can see it is annoying in this case but I'm afraid I don't have any ideas\n> of how we could avoid it without breaking the case where the message does\n> contain trailers.\n\nFirst, one issue is that this is not documented (I was not aware of\nthe notion of trailers, well, at least concerning a special handling\nby Git).\n\nThen perhaps there should be some configuration to define which\ntokens are allowed (or forbidden) for trailers. For instance,\nI would say that \"Note\" is too common in log messages to be\nregarded as a trailer token.\n\n-- \nVincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>\n100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>\nWork: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)\n"},{"id":"468498","messageId":"a97758b5-dfdc-9a24-654b-8846a9feb45d@dunelm.org.uk","threadId":"58888","inReplyTo":"20221202170144.GC5599@cventin.lip.ens-lyon.fr","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2022-12-04T15:13:52Z","receivedAt":"2022-12-04T15:14:02Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Vincent\n\nOn 02/12/2022 17:01, Vincent Lefevre wrote:\n> Hi Phillip,\n> \n> On 2022-12-02 16:41:23 +0000, Phillip Wood wrote:\n>> On 02/12/2022 14:11, Vincent Lefevre wrote:\n>>> With git 2.38.1 under Debian, when I use \"git cherry-pick -x\"\n>>> on a commit such that the last line of the log message starts\n>>> with \"note:\" (case insensitively), the blank line before the\n>>> \"cherry picked from commit\" line is missing.\n>>>\n>>> For instance:\n>>>\n>>>       New commit\n>>>       foo\n>>>       nOtE:\n>>>       (cherry picked from commit 3ba643e2eec4bdc1cd46b478ab36ee0707d241c2)\n>>\n>> \"git cherry-pick -x\" takes care not to add a blank line if there are\n>> trailers such as Signed-off-by: at the end of the message (if it did then\n>> the trailers would no longer be recognized as trailers as they would not be\n>> the last paragraph). In this case the \"nOtE:\" line looks like a trailer and\n>> so no blank line is added.\n>>\n>> I can see it is annoying in this case but I'm afraid I don't have any ideas\n>> of how we could avoid it without breaking the case where the message does\n>> contain trailers.\n> \n> First, one issue is that this is not documented (I was not aware of\n> the notion of trailers, well, at least concerning a special handling\n> by Git).\n\nThey are mentioned in the documentation for 'git commit' see the \n--signoff and --trailer options. The main reference is 'git \ninterpret-trailers'\n\n> Then perhaps there should be some configuration to define which\n> tokens are allowed (or forbidden) for trailers. For instance,\n> I would say that \"Note\" is too common in log messages to be\n> regarded as a trailer token.\n\nThere are some safeguards when looking for trailers (see the \ninterpret-trailers man page) I think you have been unlucky here, I don't \nremember this being reported before. I've cc'd Christian who knows more \nabout trailers than I do to see if he has anything to add.\n\nBest Wishes\n\nPhillip\n"},{"id":"468499","messageId":"20221204154927.GF33204@zira.vinc17.org","threadId":"58888","inReplyTo":"a97758b5-dfdc-9a24-654b-8846a9feb45d@dunelm.org.uk","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Vincent Lefevre","fromEmail":"vincent@vinc17.net","sentAt":"2022-12-04T15:49:27Z","receivedAt":"2022-12-04T15:52:23Z","isPatch":false,"sender":{"key":"vincent@vinc17.net","avatar":null},"body":"On 2022-12-04 15:13:52 +0000, Phillip Wood wrote:\n> On 02/12/2022 17:01, Vincent Lefevre wrote:\n> > First, one issue is that this is not documented (I was not aware of\n> > the notion of trailers, well, at least concerning a special handling\n> > by Git).\n> \n> They are mentioned in the documentation for 'git commit' see the --signoff\n> and --trailer options. The main reference is 'git interpret-trailers'\n\nThis issue occurs with \"git cherry-pick -x\", so that one could expect\ndocumentation there. Since I don't use trailers (this was a false\npositive), I wouldn't have the idea to look at the --trailer\ndocumentation.\n\n> > Then perhaps there should be some configuration to define which\n> > tokens are allowed (or forbidden) for trailers. For instance,\n> > I would say that \"Note\" is too common in log messages to be\n> > regarded as a trailer token.\n> \n> There are some safeguards when looking for trailers (see the\n> interpret-trailers man page) I think you have been unlucky here, I don't\n> remember this being reported before. I've cc'd Christian who knows more\n> about trailers than I do to see if he has anything to add.\n\nI think that what could be interesting there is a\ntrailer.<token>.separators option (assuming that one can\nuse an empty list of separators to disable a token), but\nthat doesn't exist.\n\n-- \nVincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>\n100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>\nWork: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)\n"},{"id":"468514","messageId":"CAP8UFD1G++GvNxCVdwDqSm4P3SseyOWNh2jKBZ4jm-OTn2Vsmg@mail.gmail.com","threadId":"58888","inReplyTo":"20221204154927.GF33204@zira.vinc17.org","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2022-12-05T12:56:02Z","receivedAt":"2022-12-05T12:56:17Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Dec 4, 2022 at 4:49 PM Vincent Lefevre <vincent@vinc17.net> wrote:\n>\n> On 2022-12-04 15:13:52 +0000, Phillip Wood wrote:\n> > On 02/12/2022 17:01, Vincent Lefevre wrote:\n> > > First, one issue is that this is not documented (I was not aware of\n> > > the notion of trailers, well, at least concerning a special handling\n> > > by Git).\n> >\n> > They are mentioned in the documentation for 'git commit' see the --signoff\n> > and --trailer options. The main reference is 'git interpret-trailers'\n>\n> This issue occurs with \"git cherry-pick -x\", so that one could expect\n> documentation there. Since I don't use trailers (this was a false\n> positive), I wouldn't have the idea to look at the --trailer\n> documentation.\n\nYeah, the documentation for the -x option on the git cherry-pick page\nshould probably say that the added line will be put at the end of the\ntrailer part of the commit message and perhaps link to the git commit\nor git interpret-trailers page. Patch welcome!\n\n> > > Then perhaps there should be some configuration to define which\n> > > tokens are allowed (or forbidden) for trailers. For instance,\n> > > I would say that \"Note\" is too common in log messages to be\n> > > regarded as a trailer token.\n> >\n> > There are some safeguards when looking for trailers (see the\n> > interpret-trailers man page) I think you have been unlucky here, I don't\n> > remember this being reported before. I've cc'd Christian who knows more\n> > about trailers than I do to see if he has anything to add.\n>\n> I think that what could be interesting there is a\n> trailer.<token>.separators option (assuming that one can\n> use an empty list of separators to disable a token), but\n> that doesn't exist.\n\nThere is the trailer.separators config option. I am not sure if it\ndisables trailers completely though if it is empty. If it doesn't,\nthat could be an interesting feature to implement for people who don't\nuse trailers at all (except for lines added by cherry-pick).\n\nA trailer.<token>.separators option that disables some <token> when\nempty could be another interesting idea, but it might have drawbacks.\nFor example you might disable the \"note\" token, but then find that\npeople sometimes use \"notes:\" or \"NB:\" or \"PS:\" or other things like\nthat at the end of their commit messages.\n"},{"id":"469152","messageId":"20221216011553.GE7846@zira.vinc17.org","threadId":"58888","inReplyTo":"CAP8UFD1G++GvNxCVdwDqSm4P3SseyOWNh2jKBZ4jm-OTn2Vsmg@mail.gmail.com","subject":"Re: git cherry-pick -x: missing blank line before the \"cherry picked from commit\" line","fromName":"Vincent Lefevre","fromEmail":"vincent@vinc17.net","sentAt":"2022-12-16T01:15:53Z","receivedAt":"2022-12-16T01:16:02Z","isPatch":false,"sender":{"key":"vincent@vinc17.net","avatar":null},"body":"On 2022-12-05 13:56:02 +0100, Christian Couder wrote:\n> On Sun, Dec 4, 2022 at 4:49 PM Vincent Lefevre <vincent@vinc17.net> wrote:\n> > I think that what could be interesting there is a\n> > trailer.<token>.separators option (assuming that one can\n> > use an empty list of separators to disable a token), but\n> > that doesn't exist.\n> \n> There is the trailer.separators config option. I am not sure if it\n> disables trailers completely though if it is empty. If it doesn't,\n> that could be an interesting feature to implement for people who don't\n> use trailers at all (except for lines added by cherry-pick).\n\nI have not tried yet, but the drawback is that it could be used\nonly if trailers are not used at all.\n\n> A trailer.<token>.separators option that disables some <token> when\n> empty could be another interesting idea, but it might have drawbacks.\n> For example you might disable the \"note\" token, but then find that\n> people sometimes use \"notes:\" or \"NB:\" or \"PS:\" or other things like\n> that at the end of their commit messages.\n\nYes, or \"References:\" or \"https:\". Like that, which has just happened\nto me: :-(\n\n[...]\n    References:\n      https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00001.html\n      https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00027.html\n      https://gmplib.org/list-archives/gmp-bugs/2022-October/005200.html\n    (cherry picked from commit 277faface2023449c91c1751630e760d136ae619)\n\nEven when one knows the issue, it is too easy to forget it.\n\n-- \nVincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>\n100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>\nWork: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)\n"}]}