From 3d50adc5fe912b809bd5fb3ceae1d7113635875c Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Fri, 22 Oct 2021 11:49:54 +0200 Subject: [PATCH] astyle: restore backwards compatibility with old pre-commit hook I removed the filtering logic from the shell script in #18482 because the new pre-commit hook already takes care of it. The problem is if you don't update the .git/hooks/pre-commit file and use the new shell script there's no filtering of files done and it checks all files for every file. This commit restores backwards compatibility because it does not hurt until I have an automatic way to update the pre-commit hook file. --- Tools/astyle/files_to_check_code_style.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tools/astyle/files_to_check_code_style.sh b/Tools/astyle/files_to_check_code_style.sh index 8d1e38f491..9098b500e9 100755 --- a/Tools/astyle/files_to_check_code_style.sh +++ b/Tools/astyle/files_to_check_code_style.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash set -eu +PATTERN="-e ." + +if [ $# -gt 0 ]; then + PATTERN="$1" +fi + exec find boards msg src platforms test \ -path msg/templates/urtps -prune -o \ -path platforms/nuttx/NuttX -prune -o \ @@ -21,4 +27,4 @@ exec find boards msg src platforms test \ -path src/lib/crypto/monocypher -prune -o \ -path src/lib/crypto/libtomcrypt -prune -o \ -path src/lib/crypto/libtommath -prune -o \ - -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) + -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN