Re: Should Git Tag trailer formatting work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Jeff, thanks.

Yeah, I can render trailer information when using your examples but *only* if I disable signing my tags. Here's what my global Git configuration looks like:

[tag]
  gpgSign = true
  sort = version:refname

...and here's a better example to demonstrate:

mkdir demo
cd demo
git init

touch one.txt
git add .
git commit --message "Added one"
git tag 0.0.0 --message "Version 0.0.0" --trailer A:0

touch two.txt
git add .
git commit --message "Added two"
git tag 0.0.1 --message "Version 0.0.1" --no-sign --trailer A:1

Notice how Version 0.0.0 creates a signed tag but Version 0.0.1 forces the tag to not be signed. I can then run the following:

git tag --list \
        --format="%(refname:short)|%(taggerdate:short)|%(taggername)|%(subject)|%(trailers:key=A)" \
       | column -s "|" -t

...to produce this output:

0.0.0  2024-09-06  Brooke Kuhlmann  Version 0.0.0
0.0.1  2024-09-06  Brooke Kuhlmann  Version 0.0.1  A: 1

So I can see that Git tag trailers are working but only if my tags are *not* signed. Here's what each tag looks like when I cat them out:

git cat-file tag 0.0.0

object ad13b82ff41d5698cfb03a06b95e6e5a98386ed4
type commit
tag 0.0.0
tagger Brooke Kuhlmann <brooke@xxxxxxxxxxxxx> 1725635799 -0600

Version 0.0.0

A: 0
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE0UiFiNLe33PmLweh8rxJvE/7mkgFAmbbHNcACgkQ8rxJvE/7
mkiBFRAAlaFfRQK6fK4J9z49tF9OR0vMJRygtR4LZE1z2JmPUTTapKf8meIFIFxU
GeIAfcD8aofgV6WeGDCIaL0Kg0quInlWA19Y+Yqv5ZL3J6dEkWu8R9hmgKK8jCPo
U+EtaCSv0cM+ZmN4paCM9ZirdvnTQY5gaTJ9D+xreklaqZSryrAFfMH6UdsGnFtQ
KkR+G2B9RCuD2loV5KBIttYAhnGf54xJxfGFcZiIGD/qErWWgABIN6zDP5SHPMXz
NOjDDLh3ZUA0D1nXqxS7Aq4fe4wrRIGmtLs+Kh+fnHLuhfBh7vqrkUBydGjiGuc3
bQVOHCxe3kpfqS+P/12aGfc4yTWdL89qBWZGCEtTPw4wqLAOvzMzJ6ffc6TKdz6r
mNsV4ZWKwigS6KpCyJt1ecWq3jAZIPwx2ADsw/JQm82LfcTrn3d3nIV/0qpM0oVL
jOoZh+ozPq2bWZWqHk6PfaW2m0dKN8w9o9paJGUdyj5KjolLtak7sY067ATbIFXM
hdkpFAhvc6VhFNIcfYStLd1yJggCigpXbtx/+QG/PMMx6wMwcz0kko1KfWW4fxs0
SiEbHO3Ja0o1DG31QFb54MOi8I7n8xVgtckSj+dr+/b4hEv8b1BS5x61NJaTsxu4
PQcWEburYAPeFkbmT/ji52vCLOetQ4GPEc2+sDPvZioxQgUuhzk=
=v8eJ
-----END PGP SIGNATURE-----



git cat-file tag 0.0.1

object e10b4d0578a5b309aac31d036a2d33a7389eff2e
type commit
tag 0.0.1
tagger Brooke Kuhlmann <brooke@xxxxxxxxxxxxx> 1725635858 -0600

Version 0.0.1

A: 1

So it seems like signing my tags is causing trailer information to be lost?


> On Sep 5, 2024, at 10:04 PM, Jeff King <peff@xxxxxxxx> wrote:
> 
> On Thu, Sep 05, 2024 at 10:05:24AM -0600, Brooke Kuhlmann wrote:
> 
>> 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@xxxxxxxx> 1725595316 -0400
> 
>  Version 0.0.0
> 
>  An example.
> 
>  Insertions: 10
> 
> -Peff






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux