Skip to content

Commit 18e19ba

Browse files
committed
use --no-run-if-empty to avoid empty batches
1 parent 84cfdc1 commit 18e19ba

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

scripts/githooks/check-file-format.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function main-invocation() {
7171
# 2MB on Linux but only 256KB on macOS. Assume a maximum filename
7272
# length of 200 characters and limiting us to batches of 1000 files
7373
# gives us a bit of a safety margin.
74-
dry_run_opt="${dry_run_opt:-}" xargs --max-args=1000 scripts/githooks/check-file-format.sh "$method"
74+
dry_run_opt="${dry_run_opt:-}" xargs --max-args=1000 --no-run-if-empty scripts/githooks/check-file-format.sh "$method"
7575
}
7676

7777
# Run editorconfig natively.
@@ -96,13 +96,10 @@ function main-tool-wrapper--via-docker() {
9696

9797
# shellcheck disable=SC2155
9898
local image=$(name=mstruebing/editorconfig-checker docker-get-image-version-and-pull)
99-
# We use /dev/null here as a backstop in case there are no files in the state
100-
# we choose. If the filter comes back empty, adding `/dev/null` onto it has
101-
# the effect of preventing `ec` from treating "no files" as "all the files".
10299
docker run --rm --platform linux/amd64 \
103100
--volume "$PWD":/check \
104101
"$image" \
105-
sh -c "ec --exclude '.git/' $dry_run_opt $(printf '%q ' "$@") /dev/null"
102+
sh -c "ec --exclude '.git/' $dry_run_opt $(printf '%q ' "$@")"
106103
}
107104

108105
# ==============================================================================

0 commit comments

Comments
 (0)