{"thread":{"id":"49451","subject":"Request for examples on git log --format:tformat","startedAt":"2018-09-28T18:30:16Z","lastAt":"2018-09-29T07:56:41Z","messageCount":2,"participants":["Daniel Lo","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"359229","messageId":"CAOeX3KXASgnyVcZuTAjyXLgnZpeA1FD3XXvSoRd11b9V9jpGFg@mail.gmail.com","threadId":"49451","inReplyTo":null,"subject":"Request for examples on git log --format:tformat","fromName":"Daniel Lo","fromEmail":"wilburlo@gmail.com","sentAt":"2018-09-28T18:29:32Z","receivedAt":"2018-09-28T18:30:16Z","isPatch":false,"sender":{"key":"wilburlo@gmail.com","avatar":null},"body":"Greetings,\n\nI was reviewing the tformat parameters on:\nhttps://git-scm.com/docs/git-log (middle of the page).\n\nSpecifically: %<|(<N>): make the next placeholder take at least until\nNth columns, padding spaces on the right if necessary\n\nI found the instructions regard space formatting to be very confusing.\nAn example would be helpful to illustrate what the proper space\nformatting syntax is:\n\nEx:\ngit log --format=\"tformat:%h %<(15)%an %s\"\n\n0123456 Author Name Commit message - author name is formatted to be\npadded with space to occupy at least 15 characters\n\nAll of the special symbols %<|(<>) made me confused to what was\nrequired and what was describing the syntax.\n\nThank you!\n\n-daniel\n\n\n-- \n\nPercy Shelley's poem \"Ozymandias\" is also a good argument for refactoring code.\nhttp://en.wikipedia.org/wiki/Ozymandias\n"},{"id":"359278","messageId":"20180929075638.GG2174@sigill.intra.peff.net","threadId":"49451","inReplyTo":"CAOeX3KXASgnyVcZuTAjyXLgnZpeA1FD3XXvSoRd11b9V9jpGFg@mail.gmail.com","subject":"Re: Request for examples on git log --format:tformat","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-09-29T07:56:38Z","receivedAt":"2018-09-29T07:56:41Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 28, 2018 at 11:29:32AM -0700, Daniel Lo wrote:\n\n> I was reviewing the tformat parameters on:\n> https://git-scm.com/docs/git-log (middle of the page).\n> \n> Specifically: %<|(<N>): make the next placeholder take at least until\n> Nth columns, padding spaces on the right if necessary\n> \n> I found the instructions regard space formatting to be very confusing.\n> An example would be helpful to illustrate what the proper space\n> formatting syntax is:\n> \n> Ex:\n> git log --format=\"tformat:%h %<(15)%an %s\"\n> \n> 0123456 Author Name Commit message - author name is formatted to be\n> padded with space to occupy at least 15 characters\n> \n> All of the special symbols %<|(<>) made me confused to what was\n> required and what was describing the syntax.\n\nI'm not sure if you're asking for somebody to give an example here, or\nsuggesting that the documentation should contain an example.\n\nIf the former, then an example matching the documentation you quoted is:\n\n  git log --format='%h %<|(15)%an %s'\n\nThe difference (I think -- I've never actually use either of these in\nthe wild myself) between %< and %<| is that the former pads out to N\nspaces, and the latter pads out until we've reached the Nth column (so\ntaking into account all prior content on the line, too).\n\nTo see the difference try:\n\n  # pad names to 30 chars\n  git log --format='%h %<(30)%an %s'\n\nversus\n\n  # pad out to the 30th column, including the hash\n  git log --format='%h %<|(30)%an %s'\n\nversus\n\n  # pad out to the 30th column, but without the hash there should be\n  # much more whitespace\n  git log --format='%<|(30)%an %s'\n\n\nIf you are suggesting that there should be some examples in the\ndocumentation, I agree (I had to stare at the descriptions and run a few\ntests myself to figure this out). I'm not sure if they should go near\nthe placeholder list, or in the examples section.\n\n-Peff\n\nPS Orthogonal to your question, but one tip: \"--format\" defaults to\n   \"tformat:\" if its argument contains %-placeholders.\n"}]}