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

Should Git Tag trailer formatting work?

From
Brooke Kuhlmann <brooke@alchemists.io>
Date
Sep 5, 2024, 16:05 UTC
Message-ID
<E46F3EFF-66D1-4B29-BCF3-6FFAB2504411@alchemists.io>
Hello. đź‘‹
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
```
Notice that I'm using the same syntax (`%(trailers:key=Insertions)`) as used in the git for-each-ref (https://git-scm.com/docs/git-for-each-ref#Documentation/git-for-each-ref.txt-rawsize) documentation. If it helps, I also create my Git tag using `git tag` and formatting my message as follows:

``` Version 0.0.0

An example.
Insertions: 10
```
Shouldn't the formatting of my git tags pick up the "Insertions" trailer key and print it? Is this a bug or am I doing something wrong?
Thanks!
Next: Jeff King
Message 1 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.