#!/bin/bash
#
# Release note HTML generation
#
# Copyright (C) 2015 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
##
release-tags() {
local -i limit="$1"
git tag -l '[0-9]*' \
| tac \
| { test $limit -gt 0 \
&& head -n$limit \
|| cat; }
}
tag-subject() {
local tag="${1?Missing tag}"
git tag -n1 -l "$tag" \
| sed 's/ \+/: /'
}
tag-body() {
local tag="${1?Missing tag}"
git cat-file tag "$tag" \
| awk '/^-----BEGIN PGP SIGNATURE-----$/ { exit; }
nl>=2 { print; next; }
/^$/ { nl++; }' \
| sed 's/&/\&\;/g
s/\<\;/g;
s/>/\>\;/g;'
}
# optional limit
declare -i limit="$1"
for t in $( release-tags "$limit" ); do
cat <$( tag-subject "$t" )
$( tag-body "$t" )
EOF
done