Created
April 6, 2012 21:23
-
-
Save nacin/2323060 to your computer and use it in GitHub Desktop.
Nacin's SVN override
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
# SVN override to prevent commits that try to implicitly commit more than one file. | |
# Has weaned me off of svn ci -m very effectively. I now almost always use svn ci, | |
# which usually results in me writing longer and more helpful commit messages. | |
# Also, it prevents me from committing unrelated code, so there's that. | |
# | |
# Also checks for error_log, var_dump, and console.log, and rejects these commits. | |
function svn() { | |
if [ "$1" == "ci" ] && [ "$2" == "-m" ] && [ -z "$4" ] && [ "$(svn stat --ignore-externals | grep '^[^?X]' | wc -l | awk '{print $1}')" -gt 1 ]; then | |
svn stat --ignore-externals | grep '^[^?X]' | |
echo "" | |
echo $3 | |
echo "" | |
echo "Unbounded commit... What are you doing, man?" | |
return | |
elif [ "$1" == "ci" ] && [ "$(svn diff | grep -E '^\+.*(error_log|var_dump|console\.log)' | wc -l | awk '{print $1}')" -gt 0 ]; then | |
echo "You left in some debug cruft." | |
return | |
fi | |
/usr/bin/svn "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some other things I'd like to add: