{"thread":{"id":"42914","subject":"Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","startedAt":"2016-07-24T13:46:14Z","lastAt":"2016-07-25T17:28:29Z","messageCount":7,"participants":["Ilya Tumaykin","Beat Bolli","Johannes Schindelin","Jakub Narębski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"292057","messageId":"8915446.47C9zkNvuX@photon","threadId":"42914","inReplyTo":null,"subject":"Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Ilya Tumaykin","fromEmail":"itumaykin@gmail.com","sentAt":"2016-07-24T13:46:01Z","receivedAt":"2016-07-24T13:46:14Z","isPatch":false,"sender":{"key":"itumaykin@gmail.com","avatar":null},"body":"Hello.\n\nSteps to reproduce:\n$ git init\n$ >123\n$ git add 123\n$ git commit -v -m 'This is subject' -m 'And this is body'\n$ git --no-pager log -1 --format='format:%+s%+b'\n\nActual results:\n```\n\nThis is subject\nAnd this is body\n```\n\nExpected results:\n```\n\nThis is subject\n\nAnd this is body\n```\n\n$ git --version\ngit version 2.9.2\n\nPlease fix.\n\n-- \nBest regards.\nIlya Tumaykin.\n"},{"id":"292080","messageId":"loom.20160725T085326-574@post.gmane.org","threadId":"42914","inReplyTo":"8915446.47C9zkNvuX@photon","subject":"Re: Bug:","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2016-07-25T06:55:41Z","receivedAt":"2016-07-25T06:56:01Z","isPatch":false,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Ilya Tumaykin <itumaykin <at> gmail.com> writes:\n\n> $ git --no-pager log -1 --format='format:%+s%+b'\n> Please fix.\n\nSimply use `git --no-pager log -1 --format='format:%+s%n%+b'`\n\nThe message body excludes the empty line preceding it.\n\n\n\n\n\n"},{"id":"292083","messageId":"alpine.DEB.2.20.1607250926320.14111@virtualbox","threadId":"42914","inReplyTo":"8915446.47C9zkNvuX@photon","subject":"Re: Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-25T07:33:00Z","receivedAt":"2016-07-25T07:33:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ilya,\n\nOn Sun, 24 Jul 2016, Ilya Tumaykin wrote:\n\n> Steps to reproduce:\n> $ git init\n> $ >123\n> $ git add 123\n> $ git commit -v -m 'This is subject' -m 'And this is body'\n> $ git --no-pager log -1 --format='format:%+s%+b'\n> \n> Actual results:\n> ```\n> \n> This is subject\n> And this is body\n> ```\n> \n> Expected results:\n> ```\n> \n> This is subject\n> \n> And this is body\n> ```\n\nThe empty line between commit subject and body is neither part of the\nsubject nor of the body. That means that the above-mentioned expectation\nwas incorrect.\n\nUnless you somehow allow empty commit messages (Git does not, unless you\nplay games with low-level commands), the second '+' is unnecessarily\nconditional. Therefore \"%s%n%+b\" *might* do what you intended (I would not\nknow, because that information was missing from the report).\n\nCiao,\nJohannes\n"},{"id":"292084","messageId":"1693749.WYZjdcdZj5@photon","threadId":"42914","inReplyTo":"alpine.DEB.2.20.1607250926320.14111@virtualbox","subject":"Re: Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Ilya Tumaykin","fromEmail":"itumaykin@gmail.com","sentAt":"2016-07-25T07:51:13Z","receivedAt":"2016-07-25T07:51:21Z","isPatch":false,"sender":{"key":"itumaykin@gmail.com","avatar":null},"body":"On Monday 25 July 2016 09:33:00 Johannes Schindelin wrote:\n> Hi Ilya,\n> \n> On Sun, 24 Jul 2016, Ilya Tumaykin wrote:\n> > Steps to reproduce:\n> > $ git init\n> > $ >123\n> > $ git add 123\n> > $ git commit -v -m 'This is subject' -m 'And this is body'\n> > $ git --no-pager log -1 --format='format:%+s%+b'\n> > \n> > Actual results:\n> > ```\n> > \n> > This is subject\n> > And this is body\n> > ```\n> > \n> > Expected results:\n> > ```\n> > \n> > This is subject\n> > \n> > And this is body\n> > ```\n> \n> The empty line between commit subject and body is neither part of the\n> subject nor of the body. That means that the above-mentioned expectation\n> was incorrect.\n\nAccording to 'git-log' man page '%+b' should insert linefeed \"immediately \nbefore the expansion if and only if the placeholder expands to a non-empty \nstring.\" Here \"%b\" expands to a non-empty string, thus I expect a linefeed \nbefore it. Or am I misinterpreting man page somehow?\n\n> Unless you somehow allow empty commit messages (Git does not, unless you\n> play games with low-level commands), the second '+' is unnecessarily\n> conditional. Therefore \"%s%n%+b\" *might* do what you intended (I would not\n> know, because that information was missing from the report).\n\nI want to display '%B', but add colours to '%s'. Thus I have to separately \ninclude '%s' and '%b', and not just '%B'. I was using '%+s%n%+b' with extra \ncolour formatting as a workaround for some time now.\n\n> Ciao,\n> Johannes\n\n-- \nBest regards.\nIlya Tumaykin.\n"},{"id":"292085","messageId":"alpine.DEB.2.20.1607251003360.14111@virtualbox","threadId":"42914","inReplyTo":"1693749.WYZjdcdZj5@photon","subject":"Re: Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-25T08:06:28Z","receivedAt":"2016-07-25T08:07:26Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ilya,\n\nOn Mon, 25 Jul 2016, Ilya Tumaykin wrote:\n\n> On Monday 25 July 2016 09:33:00 Johannes Schindelin wrote:\n> > \n> > On Sun, 24 Jul 2016, Ilya Tumaykin wrote:\n> > [...]\n> > > $ git --no-pager log -1 --format='format:%+s%+b'\n> > > \n> > > Actual results:\n> > > ```\n> > > \n> > > This is subject\n> > > And this is body\n> > > ```\n> \n> According to 'git-log' man page '%+b' should insert linefeed \"immediately \n> before the expansion if and only if the placeholder expands to a non-empty \n> string.\" Here \"%b\" expands to a non-empty string, thus I expect a linefeed \n> before it. Or am I misinterpreting man page somehow?\n\nThe line break is there: after the subject. The misinterpretation is most\nlikely the assumption that the new-line \"character\" is part of the commit\nsubject; It is not.\n\n> > Unless you somehow allow empty commit messages (Git does not, unless\n> > you play games with low-level commands), the second '+' is\n> > unnecessarily conditional. Therefore \"%s%n%+b\" *might* do what you\n> > intended (I would not know, because that information was missing from\n> > the report).\n> \n> I want to display '%B', but add colours to '%s'. Thus I have to\n> separately include '%s' and '%b', and not just '%B'. I was using\n> '%+s%n%+b' with extra colour formatting as a workaround for some time\n> now.\n\nOkay. Hopefully the explanation above clarifies that this is not a\nwork-around, but the correct solution.\n\nCiao,\nJohannes\n"},{"id":"292090","messageId":"2082892.BZVOcV7i8n@photon","threadId":"42914","inReplyTo":"alpine.DEB.2.20.1607251003360.14111@virtualbox","subject":"Re: Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Ilya Tumaykin","fromEmail":"itumaykin@gmail.com","sentAt":"2016-07-25T10:49:25Z","receivedAt":"2016-07-25T10:49:33Z","isPatch":false,"sender":{"key":"itumaykin@gmail.com","avatar":null},"body":"On Monday 25 July 2016 10:06:28 Johannes Schindelin wrote:\n> Hi Ilya,\n> \n> On Mon, 25 Jul 2016, Ilya Tumaykin wrote:\n> > On Monday 25 July 2016 09:33:00 Johannes Schindelin wrote:\n> > > On Sun, 24 Jul 2016, Ilya Tumaykin wrote:\n> > > [...]\n> > > \n> > > > $ git --no-pager log -1 --format='format:%+s%+b'\n> > > > \n> > > > Actual results:\n> > > > ```\n> > > > \n> > > > This is subject\n> > > > And this is body\n> > > > ```\n> > \n> > According to 'git-log' man page '%+b' should insert linefeed \"immediately\n> > before the expansion if and only if the placeholder expands to a non-empty\n> > string.\" Here \"%b\" expands to a non-empty string, thus I expect a linefeed\n> > before it. Or am I misinterpreting man page somehow?\n> \n> The line break is there: after the subject. The misinterpretation is most\n> likely the assumption that the new-line \"character\" is part of the commit\n> subject; It is not.\n\nI see. Thank you very much for the explanation. This does help me.\n\n-- \nBest regards.\nIlya Tumaykin.\n"},{"id":"292109","messageId":"57964C29.9000902@gmail.com","threadId":"42914","inReplyTo":"alpine.DEB.2.20.1607250926320.14111@virtualbox","subject":"Re: Bug: \"git log --format='format:%+s%+b'\" doesn't insert newline before body","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2016-07-25T17:28:09Z","receivedAt":"2016-07-25T17:28:29Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 2016-07-25 o 09:33, Johannes Schindelin pisze:\n\n> Therefore \"%s%n%+b\" *might* do what you intended (I would not\n> know, because that information was missing from the report).\n\nShouldn't it be \"%s%n%n%-b\" or \"%s%n%-b\"?\n\n-- \nJakub Narębski\n"}]}