summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvamander <avamander@gmail.com>2021-05-03 14:12:33 +0300
committerJF002 <JF002@users.noreply.github.com>2021-07-24 15:55:52 +0200
commit1ba99d242788b50b26b739d571d4866a6c2d0fed (patch)
treee4443d1e0a57e30b0911e6b8a8edc3b7fc3f988f
parent10ef3a749ede4a27fe162bd730b26fb778ffaa85 (diff)
Made the pre-commit hook fail explicitly when the executable doesn't exist
-rwxr-xr-xhooks/pre-commit6
1 files changed, 6 insertions, 0 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit
index 15961f19..5e10aa19 100755
--- a/hooks/pre-commit
+++ b/hooks/pre-commit
@@ -5,6 +5,12 @@ else
CLANG_FORMAT_EXECUTABLE="clang-format-11"
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)
do
if [[ "$FILE" =~ src/[A-Za-z0-9\ \-]+*\.(c|h|cpp|cc)$ ]]; then