{"thread":{"id":"45386","subject":"git pretty format: \"%+b\" not working with \"%w\" in front of it?","startedAt":"2017-03-15T14:12:00Z","lastAt":"2017-03-15T15:21:11Z","messageCount":2,"participants":["Robert Dailey","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"314135","messageId":"CAHd499BP-iaXJDNg+4RWB9GaQ1xW8ZnH0oysWSa7u_DCSWFFDg@mail.gmail.com","threadId":"45386","inReplyTo":null,"subject":"git pretty format: \"%+b\" not working with \"%w\" in front of it?","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2017-03-15T14:08:10Z","receivedAt":"2017-03-15T14:12:00Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"I have the following log:\n\n$ git log\n\ncommit 7ffb909bb8f38607e3d6d9f3504a66ca978f0ac2\nAuthor: Robert Dailey <robert@ziosk.com>\nDate:   Mon Dec 12 11:01:00 2016 -0600\n\n    Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n\n    This is still FAR from complete....\n\n\nI want to generate changelogs, using github markdown list format. I\ntried doing that using this command:\n\n$ git log --pretty=format:\"* %s%n%w(100,2,2)%+b\"\n\nHowever, the 2nd newline is not inserted:\n\n* Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n   This is still FAR from complete....\n\nThe format I'm expecting is:\n\n* Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n\n  This is still FAR from complete....\n\nThis seems to work, but I do not get the 2-space indentation required\nto continue text on the current list item:\n\n$ git log --pretty=format:\"* %s%n%+b\"\n\n* Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n\nThis is still FAR from complete....\n\nSo why isn't it working when I use %w before the %+b? Am I doing\nsomething wrong? Note I'm using git version 2.10 on Windows through\nGit Bash.\n"},{"id":"314138","messageId":"20170315151853.c3mn7xyc5fqmkkn4@sigill.intra.peff.net","threadId":"45386","inReplyTo":"CAHd499BP-iaXJDNg+4RWB9GaQ1xW8ZnH0oysWSa7u_DCSWFFDg@mail.gmail.com","subject":"Re: git pretty format: \"%+b\" not working with \"%w\" in front of it?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-03-15T15:18:53Z","receivedAt":"2017-03-15T15:21:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 15, 2017 at 09:08:10AM -0500, Robert Dailey wrote:\n\n> $ git log\n> \n> commit 7ffb909bb8f38607e3d6d9f3504a66ca978f0ac2\n> Author: Robert Dailey <robert@ziosk.com>\n> Date:   Mon Dec 12 11:01:00 2016 -0600\n> \n>     Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n> \n>     This is still FAR from complete....\n> \n> \n> I want to generate changelogs, using github markdown list format. I\n> tried doing that using this command:\n> \n> $ git log --pretty=format:\"* %s%n%w(100,2,2)%+b\"\n> \n> However, the 2nd newline is not inserted:\n> \n> * Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n>    This is still FAR from complete....\n> \n> The format I'm expecting is:\n> \n> * Add initial skeleton files & a few interfaces for new kizi/sc16 stuff\n> \n>   This is still FAR from complete....\n\nHmm. I think the leading newline is added, but it gets eaten by the\nwrapping code. If I run your example in a debugger, we enter\nstrbuf_add_wrapped_text() with:\n\n  buf = \"* the subject line\\n\"\n  text = \"\\nthe body text\"\n  indent1=2, indent2=2, width=100\n\nWhich looks right.  But the wrapping code seems to treat blank lines\noddly. I can't quite figure out what it's _trying_ to do, but if there's\none blank line, it gets converted into a space (and thus the weird\nthree-space indent you see). But if there are two, they are both\npreserved!\n\nSo I think the line-wrapping code is simply buggy, and you are not doing\nanything wrong. But maybe I am missing some subtle case.\n\n-Peff\n"}]}