Last active
July 26, 2023 17:37
-
-
Save snipe/6868cc67618709592d79d9fe6b80fb45 to your computer and use it in GitHub Desktop.
Pre-commit hook to prevent dummy text from being committed
This file contains 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 git hook should let us prevent commits from containing words that we sometimes use | |
# as "sky is blue" proof that a method is working when it's behaving strangely. | |
disallowed="poop fart poopy farty shit fuck" | |
git diff --cached --name-status | while read x file; do | |
if [ "$x" == 'D' ]; then continue; fi | |
for word in $disallowed | |
do | |
if egrep $word $file ; then | |
echo "ERROR: Disallowed expression \"${word}\" in file: ${file}" | |
exit 1 | |
fi | |
done | |
done || exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's important to love what you do for a living :D