Skip to content

Commit 44ca17a

Browse files
committed
Make sure formatting scripts respect git ignored files
Even for files ignored with a global .gitignore or through `.git/info/exclude`
1 parent 87ec3ad commit 44ca17a

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

scripts/check-format.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,4 @@ set -eu
55
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)
66
cd "$ROOT_DIR"
77

8-
find . -type f \( \
9-
-name "*.c" -o -name "*.cpp" \
10-
-o -name "*.h" -o -name "*.hpp" \
11-
-o -name "*.cu" -o -name "*.cuh" \
12-
\) \
13-
-not -path "*/external/*" \
14-
-not -path "*/build/*" \
15-
-not -path "*/.tox/*" \
16-
-exec clang-format --dry-run --Werror {} \;
8+
git ls-files '*.cpp' '*.c' '*.hpp' '*.h' '*.cu' '*.cuh' | xargs -L 1 clang-format --dry-run --Werror

scripts/format.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,4 @@ set -eu
55
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)
66
cd "$ROOT_DIR"
77

8-
find . -type f \( \
9-
-name "*.c" -o -name "*.cpp" \
10-
-o -name "*.h" -o -name "*.hpp" \
11-
-o -name "*.cu" -o -name "*.cuh" \
12-
\) \
13-
-not -path "*/external/*" \
14-
-not -path "*/build/*" \
15-
-not -path "*/.tox/*" \
16-
-exec clang-format -i {} \;
8+
git ls-files '*.cpp' '*.c' '*.hpp' '*.h' '*.cu' '*.cuh' | xargs -L 1 clang-format -i

0 commit comments

Comments
 (0)