check-pol 461 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. if [ $# -eq 0 ]
  4. then
  5. echo "Usage: $0 COMMIT YOUR-MNT"
  6. exit
  7. fi
  8. BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")"
  9. BASE="$(dirname "$BASE")"
  10. cd "$BASE" || exit 1
  11. git diff --name-only $1 | while IFS='/' read -ra LINE; do
  12. if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
  13. utils/schema-check/dn42-schema.py -v policy ${LINE[1]} ${LINE[2]} $2
  14. fi
  15. done