diff --git a/format.sh b/format.sh index 9e0780870303d..39a44cf2a59c6 100755 --- a/format.sh +++ b/format.sh @@ -264,7 +264,7 @@ clang_format_changed() { MERGEBASE="$(git merge-base origin/main HEAD)" # Get the list of changed files, excluding the specified ones - changed_files=$(git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.h' '*.cpp' '*.cu' '*.cuh' | grep -vFf <(printf "%s\n" "${CLANG_FORMAT_EXCLUDES[@]}")) + changed_files=$(git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.h' '*.cpp' '*.cu' '*.cuh' | (grep -vFf <(printf "%s\n" "${CLANG_FORMAT_EXCLUDES[@]}") || echo -e)) if [ -n "$changed_files" ]; then echo "$changed_files" | xargs -P 5 clang-format -i fi