From 318d83ae43f80d174208607c896316224e112617 Mon Sep 17 00:00:00 2001 From: Mark Deric Date: Tue, 13 Aug 2024 10:19:12 -0700 Subject: [PATCH] Fix fail silently bug in pre-commit hook Without the change and in the absence of a clang-format command in the user's PATH, the script will fail in line 79 of the hook due to set -e. It will fail to produce the error message starting at line 83. The change allows the error message to print. Signed-off-by: Mark Deric --- scripts/git-pre-commit-clangformat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/git-pre-commit-clangformat.sh b/scripts/git-pre-commit-clangformat.sh index 63fef98e..3e9d536a 100755 --- a/scripts/git-pre-commit-clangformat.sh +++ b/scripts/git-pre-commit-clangformat.sh @@ -76,7 +76,7 @@ else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi -CLANGFORMAT=$(command -v clang-format) +CLANGFORMAT=$(command -v clang-format || true) # make sure the executable are correctly set if [ -z "$CLANGFORMAT" ] ; then