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

Re: [PATCH 2/2] pretty=format: Add %d to show decoration

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Apr 9, 2008, 21:40 UTC
Message-ID
<47FD37D6.2030506@lsrfire.ath.cx>
In-Reply-To
<alpine.DEB.1.00.0804071441040.430@eeepc-johanness>
Johannes Schindelin schrieb:
> With this patch, "git log --decorate --pretty=format:%d", shows the 
> name decoration (i.e. whenever a commit matches a ref, that ref's 
> name is shown).
Cute idea. :)

What about objects with multiple decoration? How about producing a comma-separated list like git-log does?

How about making %d imply --decorate? You could load the decorations lazily when it's first encountered.

> Maybe %d should expand to " (<name decoration>)" instead of "<name 
> decoration>"?

foobar2000 (http://foobar2000.org/) has a kind of music tagging language, and one of its features might be interesting for us here: you can group a placeholder and other stuff inside brackets. The construct resolves to an empty string if the placeholder is NULL, i.e. in your example "[ (%d)]" would resolve to either " (the decoration)" or "", depending on the object having a decoration or not. (It might be a better fit for --pretty=format: to use %[ and %].)

By the way, your patch reminds me that I wanted to add a placeholder for git-describe's output. I doubt I'll find time for that in the near future, though..

René
Previous: Johannes SchindelinNext: Junio C Hamano
Message 3 of 4 in “decorate: use "const struct object"”
  1. 1/2 decorate: use "const struct object"Johannes Schindelin, Apr 7, 2008
  2. 2/2 pretty=format: Add %d to show decorationJohannes Schindelin, Apr 7, 2008
  3. René ScharfeApr 9, 2008
  4. Junio C HamanoApr 10, 2008

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.