Check all files for msgid string
Revert change that checked only .po$ files, as this caused a 'file not found' error for sphinxmark generated PNG files. We really need to remove build artefacts, so handle the different types of files extra. Change-Id: I1a395af3476adcd74e2dff0ffc6520a18c72395a
This commit is contained in:
parent
ef0b73e708
commit
4014d2dc84
@ -431,21 +431,28 @@ function filter_commits {
|
||||
|
||||
# Don't add new empty files.
|
||||
for f in $(git diff --cached --name-only --diff-filter=A); do
|
||||
if [[ $f =~ .po$ ]] ; then
|
||||
# Files should have at least one non-empty msgid string.
|
||||
if ! grep -q 'msgid "[^"]' "$f" ; then
|
||||
case "$f" in
|
||||
*.po)
|
||||
# Files should have at least one non-empty msgid string.
|
||||
if ! grep -q 'msgid "[^"]' "$f" ; then
|
||||
git reset -q "$f"
|
||||
rm "$f"
|
||||
fi
|
||||
;;
|
||||
*.json)
|
||||
# JSON files fail msgid test. Ignore the locale key and confirm
|
||||
# there are string keys in the messages dictionary itself.
|
||||
if ! grep -q '"[^"].*":\s*"' "$f" ; then
|
||||
git reset -q "$f"
|
||||
rm "$f"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Anything else is not a translation file, remove it.
|
||||
git reset -q "$f"
|
||||
rm "$f"
|
||||
fi
|
||||
fi
|
||||
if [[ $f =~ .json$ ]] ; then
|
||||
# Ignore the locale key and confirm there are string keys
|
||||
# in the messages dictionary itself.
|
||||
if ! grep -q '"[^"].*":\s*"' "$f" ; then
|
||||
git reset -q "$f"
|
||||
rm "$f"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Don't send files where the only things which have changed are
|
||||
|
Loading…
Reference in New Issue
Block a user