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 foothen 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