Skip to content

Commit

Permalink
Fix fail silently bug in pre-commit hook
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Mark Deric committed Aug 14, 2024
1 parent 3936778 commit 318d83a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/git-pre-commit-clangformat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 318d83a

Please sign in to comment.