Last active
February 26, 2018 16:27
-
-
Save brendan-donegan/22c4a02240261669c97a27d036ba6fbe 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
#!/bin/sh | |
# | |
# This pre-commit hook looks for `fdescribe`, `fcontext`, `fit`, `fspecify` and `fexample` in the | |
# staged files and exits with an error code of 1 if there are such changes. | |
# | |
STATUS=0 | |
for focus in fdescribe fcontext fit fspecify fexample; do | |
FILES=$(git diff --staged -G"^\s*$focus\(" --name-only | wc -l) | |
if [ $FILES -gt 0 ] | |
then | |
echo "You forgot to remove a $focus in the following files:" | |
git diff --staged --name-only -G"^\s*$focus\(" | |
echo "" | |
STATUS=1 | |
fi | |
done | |
exit $STATUS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment