From 7c485fae0c70990e7119a85301e7715aafb32be5 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 6 Oct 2022 22:59:33 +0200 Subject: [PATCH] Make use of `git ls-files` filtering instead of piping to grep --- CI/check_clang_format.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CI/check_clang_format.sh b/CI/check_clang_format.sh index 3acb7a5c72..53d4ca4a64 100755 --- a/CI/check_clang_format.sh +++ b/CI/check_clang_format.sh @@ -3,8 +3,6 @@ set -o pipefail CLANG_FORMAT="${CLANG_FORMAT:-clang-format}" -git ls-files | - grep -v '^extern/' | - grep -P '\.(cpp|hpp|h)$' | +git ls-files -- ':(exclude)extern/' '*.cpp' '*.hpp' '*.h' | xargs -I '{}' -P $(nproc) bash -ec "\"${CLANG_FORMAT:?}\" --dry-run -Werror \"\${0:?}\" &> /dev/null || \"${CLANG_FORMAT:?}\" \"\${0:?}\" | git diff --color=always --no-index \"\${0:?}\" -" '{}' || ( echo "clang-format differences detected"; exit -1 )