Skip to content

Commit

Permalink
ci: Use brace I/O group instead of psub
Browse files Browse the repository at this point in the history
  • Loading branch information
dongcarl committed Aug 2, 2021
1 parent 41dc5d7 commit a1058e2
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions contrib/files-touched-check
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,35 @@ export LC_ALL=C
set -e -o pipefail
export TZ=UTC

while read -r status name; do
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
case "$name" in
README.md) continue ;;
.cirrus.yml) continue ;;
contrib/*) continue ;;
esac

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
if [ "$status" != "A" ]; then
echo "ERR: File status is not 'A' (for add): '$status'"
exit 1
fi

done < <(git diff --no-commit-id --name-status -r "${1:-${CIRRUS_BASE_SHA}...HEAD}")
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
}

0 comments on commit a1058e2

Please sign in to comment.