-
-
Save stanislaw/7b1e77c6d60acc365baa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
declare -i ERRORS=0 | |
if git rev-parse --verify HEAD > /dev/null 2>&1 | |
then | |
AGAINST=HEAD | |
else | |
AGAINST=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi | |
for FILE in `git diff-index --name-only $AGAINST --`; | |
do | |
if grep -q '\(#\|\/\/\|\;\|\-\-\)[[:blank:]]*UNCOMMITABLE' $FILE | |
then | |
echo -e "\033[41m$FILE\033[0m\033[31m contains uncommitable changes!\033[0m" | |
((ERRORS++)) | |
fi | |
done | |
if [ $ERRORS -gt 0 ] | |
then | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍