blob: 3775e28c556f70e6f42b8bdb415b6c84f6a8a436 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/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.xz 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.xz add -C "$(
git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" |
gpg --output - --armor --detach-sign |
git hash-object -w --stdin
)" "$tag"
fi
done
|