{"thread":{"id":"40781","subject":"Replicating the default \"git log\" format with a format string.","startedAt":"2015-11-12T00:55:53Z","lastAt":"2015-11-13T21:52:46Z","messageCount":4,"participants":["Kannan Goundan","Jeff King","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"273238","messageId":"loom.20151112T011419-749@post.gmane.org","threadId":"40781","inReplyTo":null,"subject":"Replicating the default \"git log\" format with a format string.","fromName":"Kannan Goundan","fromEmail":"kannan@cakoose.com","sentAt":"2015-11-12T00:55:53Z","receivedAt":"2015-11-12T00:55:53Z","isPatch":false,"sender":{"key":"kannan@cakoose.com","avatar":null},"body":"For our workflow, author dates aren't very useful.  I'm looking for a way to\nconfigure Git so that \"git log\" shows commit dates instead of author dates.\n \"--pretty=fuller\" gets me almost what I want, but I'd like to avoid the\nextra two lines if possible.\n\nI tried achieving this by putting a custom format string in ~/.gitconfig:\n\n[format]\n  pretty = \"%C(auto,yellow)commit %C(auto)%H\\nAuthor: %an <%ae>\\nDate:  \n%cd\\n\\n%w(0,4,4)%B\"\n\nThis works pretty well, but has a few corner cases.  When you do \"git log\n--decorate\", the default format decorates commits with ref names.  I can add\n\"%d\" to my format string, but then the ref names show up all the time, even\nwithout \"--decorate\".\n\nThe \"--walk-reflogs\" option presents a similar problem.  The %g*\nplaceholders all become empty strings when \"--walk-reflogs\" isn't present,\nwhich is sort of what I want, but it leaves extra blank lines in the output.\n\nIs it possible to exactly replicate the default \"git log\" format with a\nformat string?\n"},{"id":"273265","messageId":"20151113053800.GE29708@sigill.intra.peff.net","threadId":"40781","inReplyTo":"loom.20151112T011419-749@post.gmane.org","subject":"Re: Replicating the default \"git log\" format with a format string.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-11-13T05:38:00Z","receivedAt":"2015-11-13T05:38:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 12, 2015 at 12:55:53AM +0000, Kannan Goundan wrote:\n\n> For our workflow, author dates aren't very useful.  I'm looking for a way to\n> configure Git so that \"git log\" shows commit dates instead of author dates.\n>  \"--pretty=fuller\" gets me almost what I want, but I'd like to avoid the\n> extra two lines if possible.\n> \n> I tried achieving this by putting a custom format string in ~/.gitconfig:\n> \n> [format]\n>   pretty = \"%C(auto,yellow)commit %C(auto)%H\\nAuthor: %an <%ae>\\nDate:  \n> %cd\\n\\n%w(0,4,4)%B\"\n> \n> This works pretty well, but has a few corner cases.  When you do \"git log\n> --decorate\", the default format decorates commits with ref names.  I can add\n> \"%d\" to my format string, but then the ref names show up all the time, even\n> without \"--decorate\".\n> \n> The \"--walk-reflogs\" option presents a similar problem.  The %g*\n> placeholders all become empty strings when \"--walk-reflogs\" isn't present,\n> which is sort of what I want, but it leaves extra blank lines in the output.\n> \n> Is it possible to exactly replicate the default \"git log\" format with a\n> format string?\n\nSadly, no, I don't think it is possible with the current format\nspecifiers. It would be nice if it was, though.\n\n-Peff\n"},{"id":"273291","messageId":"CA+P7+xro=nNfzO6Q6-kGe6C=vJp-z_svd229kRZdf5QjQ+Di8g@mail.gmail.com","threadId":"40781","inReplyTo":"20151113053800.GE29708@sigill.intra.peff.net","subject":"Re: Replicating the default \"git log\" format with a format string.","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2015-11-13T21:41:23Z","receivedAt":"2015-11-13T21:41:23Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, Nov 12, 2015 at 9:38 PM, Jeff King <peff@peff.net> wrote:\n>> Is it possible to exactly replicate the default \"git log\" format with a\n>> format string?\n>\n> Sadly, no, I don't think it is possible with the current format\n> specifiers. It would be nice if it was, though.\n>\n> -Peff\n> --\n\nIsn't this something that might be obtainable using the new ref-filter\nwork being done?\n\nRegards,\nJake\n"},{"id":"273292","messageId":"20151113215246.GA14318@sigill.intra.peff.net","threadId":"40781","inReplyTo":"CA+P7+xro=nNfzO6Q6-kGe6C=vJp-z_svd229kRZdf5QjQ+Di8g@mail.gmail.com","subject":"Re: Replicating the default \"git log\" format with a format string.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-11-13T21:52:46Z","receivedAt":"2015-11-13T21:52:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 13, 2015 at 01:41:23PM -0800, Jacob Keller wrote:\n\n> On Thu, Nov 12, 2015 at 9:38 PM, Jeff King <peff@peff.net> wrote:\n> >> Is it possible to exactly replicate the default \"git log\" format with a\n> >> format string?\n> >\n> > Sadly, no, I don't think it is possible with the current format\n> > specifiers. It would be nice if it was, though.\n> \n> Isn't this something that might be obtainable using the new ref-filter\n> work being done?\n\nIt moves in the right direction, but it isn't enough. I don't recall the\nspecifics, but I think it has conditional placeholders for things like\n\"if this is non-empty print it\". But there are still some problems:\n\n  - the ref-filter formatting isn't unified with the commit\n    pretty-printer formatting. So this wouldn't help for a traversal,\n    anyway.\n\n  - the decoration thing needs a new placeholder. \"%d\" means \"always\n    show the decoration\", but the OP really wants \"show the decoration\n    if the user asked for decorations, and empty otherwise\".\n\n-Peff\n"}]}