I would like to reliably parse out the annotations of git tags.
I currently use "git show --summary", which will produce the following output on a tag pointing to a commit with another tag.
What I'd like to have is the tag name, the tag timestamp and the tag annotation for all the tags attached to the commit.
What I get is this:
% git show --summary CANCEL_test_annotated3
tag CANCEL_test_annotated3
Tagger: Christian Goetze
Date: Sat May 25 09:54:59 2013 -0700
Testing a multiline message
body line 1
body line 2
body line 3
tag CANCEL_test_annotated
Tagger: Christian Goetze
Date: Sat May 25 09:26:56 2013 -0700
Superceding message
commit b9dc6956eac2c8abb7ed1f6b556a18debfed909b
Author: Christian Goetze
Date: Fri May 24 14:35:31 2013 -0700
FIx some cut&paste errors
Arguably, it is not hard to parse this, but I can be victim of inband information.
I tried using --format, but it would appear that there is no format specifier for tag annotations, nor does there seem to be one for the tag time.
So, what's the right and proper way to do this?
For the raw tag data you should parse the output of this command.
git cat-file tag <tag-id>
It won't have any "pretty printing" for humans so is more amenable for machine parsing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With