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.
@@ -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
+ 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
- fi
- if [[ $f =~ .json$ ]] ; then
- # Ignore the locale key and confirm there are string keys
- # in the messages dictionary itself.
+ ;;
+ *.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
- fi
+ ;;
+ *)
+ # Anything else is not a translation file, remove it.
+ git reset -q "$f"
+ rm "$f"
+ ;;
+ esac
done
# Don't send files where the only things which have changed are
