Skip to content

Instantly share code, notes, and snippets.

@glyphobet
Created July 17, 2012 10:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glyphobet/3128700 to your computer and use it in GitHub Desktop.
Save glyphobet/3128700 to your computer and use it in GitHub Desktop.
self-installing git-hook to prevent accidentally committing pdb.set_trace() calls
#!/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