blob: 168d38dbb5b9e426a7a05aaaa50e224e8e50c865 (
plain) (
tree)
|
|
#!/bin/sh
set -eu
while getopts 'n:' flag; do
case "$flag" in
n)
PROJECT="$OPTARG"
;;
*)
exit 2
;;
esac
done
shift $((OPTIND -1))
assert_arg() {
if [ -z "$1" ]; then
echo "Missing $2" >&2
exit 2
fi
}
assert_arg "${PROJECT:-}" '-n PROJECT'
SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)"
for tag in $(git tag); do
COMMIT="$(git rev-list -n1 "$tag")"
if ! echo "$SIGNATURES" | grep -qF "$COMMIT"; then
echo "Adding missing signature to $tag" >&2
git notes --ref=refs/notes/signatures/tar.gz add -f -C "$(
git archive --format tar.gz --prefix "$PROJECT-${tag#v}/" "$tag" |
gpg --output - --armor --detach-sign |
git hash-object -w --stdin
)" "$tag"
fi
done
|