check-pol calls dn42-schema with invalid args if filter.txt has been edited

There's no need to validate $LINE[1] if $LINE[2] is nonempty. (Except if
git emits a path with "//", but I don't think this can happen.)
This commit is contained in:
io 2018-01-19 23:39:31 +01:00
parent 9c2a6c7cfd
commit 43ea241e7c
No known key found for this signature in database
GPG key ID: 9BD563027F0E32FC

View file

@ -12,7 +12,7 @@ BASE="$(dirname "$BASE")"
cd "$BASE" || exit 1
git diff --name-only $1 | while IFS='/' read -ra LINE; do
if [[ "${LINE[0]}" = "data" ]]; then
if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
utils/schema-check/dn42-schema.py -v policy ${LINE[1]} ${LINE[2]} $2
fi
done