aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-05-08 03:07:54 -0400
committerJunio C Hamano <gitster@pobox.com>2019-05-08 19:25:14 +0900
commitbcb4edf7af7f10878dd75ccfc3fc0f7596f2d658 (patch)
treef36bd27b37fb3c10341ec4f6f52995dcbefb294f
parentcoccicheck: optionally batch spatch invocations (diff)
downloadgit-bcb4edf7af7f10878dd75ccfc3fc0f7596f2d658.tar.gz
git-bcb4edf7af7f10878dd75ccfc3fc0f7596f2d658.zip
coccicheck: make batch size of 0 mean "unlimited"
If you have the memory to handle it, the ideal case is to run a single spatch invocation with all of the source files. But the only way to do so now is to pick an arbitrarily large batch size. Let's make "0" do this, which is a little friendlier (and doesn't otherwise have a useful meaning). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index daba958b8f..9cea614523 100644
--- a/Makefile
+++ b/Makefile
@@ -1176,6 +1176,7 @@ SP_EXTRA_FLAGS =
# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
# usually result in less CPU usage at the cost of higher peak memory.
+# Setting it to 0 will feed all files in a single spatch invocation.
SPATCH_FLAGS = --all-includes --patch .
SPATCH_BATCH_SIZE = 1
@@ -2792,7 +2793,12 @@ endif
%.cocci.patch: %.cocci $(COCCI_SOURCES)
@echo ' ' SPATCH $<; \
- if ! echo $(COCCI_SOURCES) | xargs -n $(SPATCH_BATCH_SIZE) \
+ if test $(SPATCH_BATCH_SIZE) = 0; then \
+ limit=; \
+ else \
+ limit='-n $(SPATCH_BATCH_SIZE)'; \
+ fi; \
+ if ! echo $(COCCI_SOURCES) | xargs $$limit \
$(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
>$@+ 2>$@.log; \
then \