3 # An example hook script to verify what is about to be committed.
4 # Called by "git commit" with no arguments. The hook should
5 # exit with non-zero status after issuing an appropriate message if
6 # it wants to stop the commit.
9 CLANGFORMATDIFF=`git config --get clangformatdiff.binary`
11 if [ -z "$CLANGFORMATDIFF" ]; then
12 CLANGFORMATDIFF=clang-format-diff.py
15 errors=`git diff-index --cached --diff-filter=ACMR -p HEAD -- | $CLANGFORMATDIFF -p1`
17 if [ -n "$errors" ]; then
20 echo "[ERROR] We have detected the difference between the code to commit"
21 echo "and clang-format style rules. Please fix this problem in either:"
22 echo "1) Apply patch above."
23 echo "2) Use clang-format to format lines."
24 echo "3) Reformat these lines manually."
25 echo "Aborting commit."