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

Re: [PATCH] pretty-format: add append line-feed format specifier

From
Harry Jeffery <harry@exec64.co.uk>
Date
Sep 9, 2014, 19:30 UTC
Message-ID
<540F554C.5010301@exec64.co.uk>
In-Reply-To
<xmqqmwa8k3lg.fsf@gitster.dls.corp.google.com>
On 09/09/14 20:15, Junio C Hamano wrote:
> Is this different from "%n%-d"?
>
Yes. "%n%-d" will place the newline before the expansion, not after.

log --decorate --pretty=format:"%n%-d%h\\ %t\\ [%cn]\\ %s" ---

  (HEAD, upstream/master, master)85f0837 c29da1d [Junio C Hamano] Start 
the post-2.1 cycle
  f655651 4027a43 [Junio C Hamano] Merge branch 'rs/strbuf-getcwd'
  51eeaea 1f4970c [Junio C Hamano] Merge branch 'ta/pretty-parse-config'
  4740891 8961621 [Junio C Hamano] Merge branch 'bc/archive-pax-header-mode'
---
log --decorate --pretty=format:"%_d%%h\\ %t\\ [%cn]\\ %s"
---
  (HEAD, upstream/master, master)
85f0837 c29da1d [Junio C Hamano] Start the post-2.1 cycle
f655651 4027a43 [Junio C Hamano] Merge branch 'rs/strbuf-getcwd'
51eeaea 1f4970c [Junio C Hamano] Merge branch 'ta/pretty-parse-config'
4740891 8961621 [Junio C Hamano] Merge branch 'bc/archive-pax-header-mode'
---

The latter is the output I've been trying to accomplish, and as far as I can tell, this patch is the only way to achieve it.

Well, you can do "%d%n" but that will put a blank line before every commit that doesn't have a ref.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 10 in “pretty-format: add append line-feed format specifier”
  1. pretty-format: add append line-feed format specifierHarry Jeffery, Sep 9, 2014
  2. Junio C HamanoSep 9, 2014
  3. Harry JefferySep 9, 2014
  4. Junio C HamanoSep 9, 2014
  5. Jeff KingSep 9, 2014
  6. Harry JefferySep 9, 2014
  7. Jeff KingSep 9, 2014
  8. Junio C HamanoSep 10, 2014
  9. Jeff KingSep 12, 2014
  10. Junio C HamanoSep 12, 2014

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.