Created
December 23, 2017 19:52
-
-
Save xy124/c7274555655a315b07fa59da31ef0601 to your computer and use it in GitHub Desktop.
pre-commit hook that checks the format of all files to be 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/bash | |
p=`git rev-parse --show-toplevel` | |
cd $p | |
files=$(git status --porcelain | grep '^M ' | cut -d ' ' -f 3) | |
for i in $files | |
do | |
uncrustify --check -l C -c bin/parflow.cfg $i | |
RESULT=$? | |
if [ "$RESULT" != "0" ]; then | |
echo $RESULT | |
exit $RESULT | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment