Skip to content

Instantly share code, notes, and snippets.

@while0pass
Created April 20, 2012 19:05
Show Gist options
  • Save while0pass/2431098 to your computer and use it in GitHub Desktop.
Save while0pass/2431098 to your computer and use it in GitHub Desktop.
хук для гита, чтобы нельзя было закомитить файл, если у него не проставлена кодировка UTF-8
#!/bin/sh
error=0
for file in `git diff-index --name-only HEAD | grep -e "\.py"`; do
grep -e 'coding: utf-8' $file > /dev/null
if [ $? -ne 0 ];
then
echo "python $file without coding directive"
error=1
fi
done
exit $error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment