Created
July 17, 2012 10:53
-
-
Save glyphobet/3128700 to your computer and use it in GitHub Desktop.
self-installing git-hook to prevent accidentally committing pdb.set_trace() calls
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/bash | |
mybasename=`basename $0` | |
if [ ! -e .git/hooks/${mybasename} ] ; then | |
ln -s ../../git-hooks/${mybasename} .git/hooks/${mybasename} | |
fi | |
set_traces=`git diff --cached -Gpdb\.set_trace\(\) | grep '^\+'` | |
if [ ! -z "$set_traces" ] ; then | |
echo "You have pdb.set_trace() in your code! Commit aborted!" | |
echo $set_traces | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment