update-hook: show the contents of the tag message for annotated tags
PATCH 2/4 update-hook: show the contents of the tag message for annotated tags
The annotated tag points at a commit, for which we show the short log. However, the tag itself contains a message, possibly release notes or hand-written change log - whatever it contains is worth showing. The tag message is extracted with
git cat-file tag $newrev | tail -q -n +5
Which is dangerously reliant on the format of the tag object being four header lines then the message. I don't like it, but I don't know of any other way of extracting the message. It's also missing any kind of support for the GPG signature.
--- templates/hooks--update | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
templates/hooks--update +7 -1
@@ -231,8 +231,14 @@ case "$refname_type" in echo "" echo $LOGBEGIN - echo "" + # Show the content of the tag message; this might contain a change log + # or release notes so is worth displaying. "tail -n +5" is there to + # remove the first 4 lines of the tag object, those details have + # already been summarised above + git cat-file tag $newrev | tail -q -n +5 + + echo "" if [ -n "$prevtag" ]; then git rev-list --pretty=short "$prevtag..$newrev" | git shortlog else
Signature · 1 line
1.5.0.3.402.g0c48
hoi :)
Quoted 4 lines · Andy Parkins
git cat-file tag $newrev | tail -q -n +5
Which is dangerously reliant on the format of the tag object being four header lines then the message.
I think you can split at the blank line after the header.
Signature · 1 line
Martin Waitz
Quoted 4 lines · Martin Waitz
Quoted 2 lines
Which is dangerously reliant on the format of the tag object being four header lines then the message.
I think you can split at the blank line after the header.
That's a good idea; I can't think of an efficient way of doing that in shell script though. What I need is a
grep --everything-after "^$"
:-)
Andy
Signature · 2 lines
Dr Andy Parkins, M Eng (hons), MIET [email protected]
Quoted 11 lines · Andy Parkins
Quoted 4 lines · Martin Waitz
Quoted 2 lines
Which is dangerously reliant on the format of the tag object being four header lines then the message.
I think you can split at the blank line after the header.
That's a good idea; I can't think of an efficient way of doing that in shell script though. What I need is a
grep --everything-after "^$"
sed -e '1,/^$/d'
Portable too. ;-)
Signature · 1 line
Shawn.