forked from namecoin/guix.sigs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiles-touched-check
executable file
·37 lines (32 loc) · 982 Bytes
/
files-touched-check
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
#!/usr/bin/env bash
export LC_ALL=C
set -e -o pipefail
export TZ=UTC
git diff --no-commit-id --name-status -r "${1:-${CIRRUS_BASE_SHA}...HEAD}" \
| {
while read -r status name; do
case "$name" in
README.md) continue ;;
.cirrus.yml) continue ;;
contrib/*) continue ;;
esac
if [ "$status" != "A" ]; then
echo "ERR: File status is not 'A' (for add): '$status'"
exit 1
fi
if [[ $name =~ ^[^/]+/[^/]+/[^/]+.SHA256SUMS(|.asc)$ ]]; then
if [ -z "$last_prefix" ]; then
last_prefix="$(dirname "$name")"
continue
elif [ "$last_prefix" = "$(dirname "$name")" ]; then
continue
else
echo "ERR: Added files need to be under the same prefix: '${last_prefix}'"
exit 1
fi
else
echo "ERR: Added unknown file '$name'"
exit 1
fi
done
}