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

Re: Should Git Tag trailer formatting work?

From
Jeff King <peff@peff.net>
Date
Sep 6, 2024, 04:04 UTC
Message-ID
<20240906040434.GB4168449@coredump.intra.peff.net>
In-Reply-To
<E46F3EFF-66D1-4B29-BCF3-6FFAB2504411@alchemists.io>
On Thu, Sep 05, 2024 at 10:05:24AM -0600, Brooke Kuhlmann wrote:
Show 8 quoted lines
> With the recent release of Git 2.46.0, the ability to add trailers to tags was added which is great! However, when attempting to list and format trailer information, I don't see the trailer information display using the following Bash code:
> 
> ``` 
> git tag --list \
>         --color \
>         --format="%(color:yellow)%(refname:short)%(color:reset)|%(taggerdate:short)|%(color:blue)%(color:bold)%(taggername)%(color:reset)|%(subject)|%(trailers:key=Insertions)" \
>         | column -s"|" -t
> ```
This seems to work fine for me. If I do:
  {
	echo "Version 0.0.0"
	echo
	echo "An example."
	echo
	echo "Insertions: 10"
  } >input
  git tag -F input foo
then your example above produces:
  foo  2024-09-06  Jeff King  Version 0.0.0  Insertions: 10

I wonder if the contents of the tag are not exactly as you expect, and that is fooling the trailer parser (which relies on some heuristics to find the right spot). Can you show us the output of "git cat-file tag <some-tag>"? Mine looks like:

  $ git cat-file tag foo
  object af1c73c21ab34cfbdc86da838acacc6e45ccd264
  type commit
  tag foo
  tagger Jeff King <peff@peff.net> 1725595316 -0400
  
  Version 0.0.0
  
  An example.
  
  Insertions: 10
-Peff
Previous: Brooke KuhlmannNext: Brooke Kuhlmann
Message 2 of 5 in “Should Git Tag trailer formatting work?”
  1. Brooke KuhlmannSep 5, 2024
  2. Jeff KingSep 6, 2024
  3. Brooke KuhlmannSep 6, 2024
  4. Jeff KingSep 6, 2024
  5. Brooke KuhlmannSep 6, 2024

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.