From e3797076d92ab2476d2d5d094ff2435775b5b96d Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 15 Jul 2020 11:36:39 +0200 Subject: [PATCH] Add filetype check to pre hook example We have `Language: Cpp` in .clang-format but recently it tried to format my makefile anyways. Let's add this to be sure. --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52c65035..6f9cc3a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,9 @@ You can add the following snippet to `.git/hooks/pre-commit`: ```shell for f in $(git diff --cached --name-only) do - clang-format -i $f + if [[ "$f" =~ \.(c|h)$ ]]; then + clang-format -i $f + fi done ```