bootstrap/specs/clang/template/.githooks/pre-commit

14 lines
239 B
Plaintext
Raw Normal View History

2023-11-26 21:51:41 +00:00
#!/usr/bin/env bash
set -e
filesToFormat=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.c$|\.h$/ {print $NF}'
)
for path in $filesToFormat
do
clang-format -i "$path"
git add "$path"
done