On Tue, May 07, 2019 at 11:42:28AM +0900, Junio C Hamano wrote:
> > Making "0" work as "unlimited" might be nice, but xargs doesn't support
> > that and I didn't want to make the recipe any more unreadable than it
> > already is.
>
> Sounds good. After reading the log message, I was curious if there
> is a mechanism that makes 999 special (like 0 in your hypothetical
> "0 means unlimited"), but I guess it is just "any number that is
> greater than the number of source files we have will do".
Yes, 2^31-1 is probably a better number, but it's harder to write out. :)
Here's what a patch might look like to implement "0". By still using
xargs in the unlimited code path, it's not too bad. I dunno.
---
diff --git a/Makefile b/Makefile
index daba958b8f..0765a59b7a 100644
--- a/Makefile
+++ b/Makefile
@@ -2792,7 +2792,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>[email protected]; \
then \
-Peff