Made the pre-commit hook fail explicitly when the executable doesn't exist

This commit is contained in:
Avamander 2021-05-03 14:12:33 +03:00 committed by JF002
parent 10ef3a749e
commit 1ba99d2427

View file

@ -5,6 +5,12 @@ else
CLANG_FORMAT_EXECUTABLE="clang-format-11" CLANG_FORMAT_EXECUTABLE="clang-format-11"
fi fi
if ! command -v $CLANG_FORMAT_EXECUTABLE &> /dev/null
then
echo $CLANG_FORMAT_EXECUTABLE does not exist, make sure to install it
exit 1
fi
for FILE in $(git diff --cached --name-only) for FILE in $(git diff --cached --name-only)
do do
if [[ "$FILE" =~ src/[A-Za-z0-9\ \-]+*\.(c|h|cpp|cc)$ ]]; then if [[ "$FILE" =~ src/[A-Za-z0-9\ \-]+*\.(c|h|cpp|cc)$ ]]; then