From 8a73fca63acbf863fc1be4c7cd7f98ae29d813ad Mon Sep 17 00:00:00 2001 From: Beatriz Navidad Vilches Date: Thu, 16 May 2024 12:18:28 +0000 Subject: [PATCH] Add git-clang-format check when installing pre-commit hook --- .githooks/install | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.githooks/install b/.githooks/install index a98d897d5..5c084603f 100755 --- a/.githooks/install +++ b/.githooks/install @@ -3,6 +3,12 @@ cd "$(git rev-parse --git-dir)" cd hooks -echo "Installing hooks..." -ln -s ../../.githooks/pre-commit pre-commit +echo "Installing hooks..." +# Install pre-commit hook if dependencies are satisfied +if ! [ -x "$(command -v git-clang-format)" ]; then + echo 'Error: pre-commit hook depends on git-clang-format, but is not installed.' >&2 + exit 1 +else + ln -s ../../.githooks/pre-commit pre-commit +fi echo "Done!"