Permalink
Browse files

Cleaned up the warning message for the pre-commit hook

  • Loading branch information...
apavlo committed Jan 12, 2018
1 parent 036b6d4 commit a2bb4b183e030c7505bd364815f7a70b79f54252
Showing with 15 additions and 11 deletions.
  1. +15 −11 script/git-hooks/pre-commit
@@ -8,19 +8,23 @@
# To enable, symlink this file to '.git/hooks/pre-commit' like so:
# ln -s ../../script/git-hooks/pre-commit .git/hooks/pre-commit
files=$(git diff --name-only HEAD --cached --diff-filter=d | grep '\.\(cpp\|h\)$')
if [ -n "$files" ]; then
python script/validators/source_validator.py --files $files
result=$?
if [ $result -ne 0 ]; then
echo "*******************************"
echo "*** Peloton Pre-Commit Hook ***"
echo "*******************************"
echo "Use \"./script/formatting/formatter.py -c -f\" to format all staged files or \"--no-verify\" to temporarily bypass the pre-commit hook."
FORMATTER_PATH="./script/formatting/formatter.py"
FILES=$(git diff --name-only HEAD --cached --diff-filter=d | grep '\.\(cpp\|h\)$')
if [ -n "$FILES" ]; then
python script/validators/source_validator.py --files $FILES
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "***************************************"
echo "******* Peloton Pre-Commit Hook *******"
echo "***************************************"
echo "Use \"$FORMATTER_PATH -c -f\" to format all staged files."
echo "Or use \"$FORMATTER_PATH --no-verify\" to temporarily bypass the pre-commit hook."
echo
echo "Be aware that changed files have to be staged again!"
echo "*******************************"
echo "***************************************"
fi
exit $result
exit $RESULT
fi
exit 0

0 comments on commit a2bb4b1

Please sign in to comment.