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.
This commit is contained in:
@@ -15,7 +15,9 @@ You can add the following snippet to `.git/hooks/pre-commit`:
|
|||||||
```shell
|
```shell
|
||||||
for f in $(git diff --cached --name-only)
|
for f in $(git diff --cached --name-only)
|
||||||
do
|
do
|
||||||
clang-format -i $f
|
if [[ "$f" =~ \.(c|h)$ ]]; then
|
||||||
|
clang-format -i $f
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user