Re: [PATCH] coccicheck: optionally batch spatch invocations
- From
Jeff King <peff@peff.net>
- Date
- May 7, 2019, 02:55 UTC
- Message-ID
- <20190507025501.GA3417@sigill.intra.peff.net>
- In-Reply-To
- <xmqq7eb3nfxn.fsf@gitster-ct.c.googlers.com>
On Tue, May 07, 2019 at 11:42:28AM +0900, Junio C Hamano wrote:
Show 8 quoted lines
> > 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>$@.log; \ then \ -Peff