Re: [PATCH] coccicheck: optionally batch spatch invocations
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 7, 2019, 04:52 UTC
- Message-ID
- <xmqqh8a6n9wv.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190507025501.GA3417@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> 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.
As somebody who is too used to run "diff -U999" and be happy, I cannot claim that I care enough, but the result does not look too bad.
Show 22 quoted lines
> > --- > 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