Check clang-format during pre-commit

Users who do not have clang-format installed were not able to push commits. This patch gives
better feedback to the developer by explicitely telling the user to install the package.
This commit is contained in:
Jean-Philippe Halimi 2016-11-02 16:41:43 -07:00
parent 958e81404b
commit 97b403ebe7

View File

@ -25,6 +25,13 @@ END
exit 1 exit 1
fi fi
if ! hash "clang-format" 2> /dev/null; then
cat<<END
Error: You must have clang-format installed on your system for codestyle checking purposes.
END
exit 1
fi
for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
if ! echo "$f" | egrep -q "[.](cpp|h)$"; then if ! echo "$f" | egrep -q "[.](cpp|h)$"; then
continue continue