git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Replicating the default "git log" format with a format string.

From
Jeff King <peff@peff.net>
Date
Nov 13, 2015, 21:52 UTC
Message-ID
<20151113215246.GA14318@sigill.intra.peff.net>
In-Reply-To
<CA+P7+xro=nNfzO6Q6-kGe6C=vJp-z_svd229kRZdf5QjQ+Di8g@mail.gmail.com>
On Fri, Nov 13, 2015 at 01:41:23PM -0800, Jacob Keller wrote:
Show 9 quoted lines
> On Thu, Nov 12, 2015 at 9:38 PM, Jeff King <peff@peff.net> wrote:
> >> Is it possible to exactly replicate the default "git log" format with a
> >> format string?
> >
> > Sadly, no, I don't think it is possible with the current format
> > specifiers. It would be nice if it was, though.
> 
> Isn't this something that might be obtainable using the new ref-filter
> work being done?

It moves in the right direction, but it isn't enough. I don't recall the specifics, but I think it has conditional placeholders for things like "if this is non-empty print it". But there are still some problems:

  - the ref-filter formatting isn't unified with the commit
    pretty-printer formatting. So this wouldn't help for a traversal,
    anyway.
  - the decoration thing needs a new placeholder. "%d" means "always
    show the decoration", but the OP really wants "show the decoration
    if the user asked for decorations, and empty otherwise".
-Peff
Previous: Jacob Keller
Message 4 of 4 in “Replicating the default "git log" format with a format string.”
  1. Kannan GoundanNov 12, 2015
  2. Jeff KingNov 13, 2015
  3. Jacob KellerNov 13, 2015
  4. Jeff KingNov 13, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.