Make pre-commit only check c/h/cpp/hpp files Clang format does not have a configuration for python, bash, or other files. So we should really only use it for our C++ and header files. Bug: b/187094215 Change-Id: I7886c7b1d71e69b09364cd7f456dc34c73ecc8fc
diff --git a/pre-commit b/pre-commit index b083f5b..d694756 100755 --- a/pre-commit +++ b/pre-commit
@@ -10,9 +10,9 @@ TMPDIR=$(mktemp -d -t gcp-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXXXX) diffFile=$(mktemp gpc-XXXXXXXXX --tmpdir=$TMPDIR) -# Get every file that's been added, changed, or modified in the current index -# except for shell scripts. -FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -v '\.sh') +# Get every source file that's been added, changed, or modified in the +# current index. +FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.cpp$\|\.hpp$\|\.h$\|\.c$') # Checkout a copy of current index into TMPDIR. This is necessary so that we # only read the versions of files that are being committed, and not any changes