...
 
......@@ -48,6 +48,7 @@
ERROR="no"
FILES=$(git diff-index --cached --name-only HEAD)
HAS_INFO=$(git diff-index --cached --name-only HEAD | grep "\.info")
DIR=""
if ! [ -z "$FILES" ]; then
for i in $FILES; do
......@@ -58,6 +59,18 @@ if ! [ -z "$FILES" ]; then
ERROR="yes"
fi
fi
if [ "${i##*.}" = "info" ]; then
if ! msg=$( . $i 2>&1 ); then
echo "$msg"
ERROR="yes"
fi
fi
if [ -z "$DIR" ]; then
DIR=$(dirname $i)
elif [ "$DIR" != "$(dirname $i)" ]; then
echo "Don't commit in multiple directories"
ERROR="yes"
fi
done
fi
......
......@@ -345,8 +345,13 @@ def parse_info(infopath):
Returns: a dict, as described in the "Implementation Note".
"""
with open(infopath) as infofile:
Infodict = parser.parse(infofile.read())
try:
with open(infofile, "r", encoding="utf-8") as infofile:
Infodict = parser.parse(infofile.read())
except:
with open(infofile, "r", encoding="latin-1") as infofile:
Infodict = parser.parse(infofile.read())
return Infodict
#-------------------------------------------------------------------------------