Re: [PATCH] remote-curl: simplify passing of push specs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 16, 2026, 14:28 UTC
- Message-ID
- <xmqqpl0nhutx.fsf@gitster.g>
- In-Reply-To
- <alhr2bb0lUTHtvjO@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 10 quoted lines
> On Wed, Jul 15, 2026 at 05:39:51PM +0200, René Scharfe wrote: >> > >> We could add one. Not sure it would make a measurable difference; if >> the number of specs is huge there are probably other costs that dwarf >> pushing them to a strvec. > > Yeah, I don't expect it to make a difference here, either. But by having > it we could use it in more places going forward, and that might lead to > tiny savings here and there that ultimately add up. So it'd be nudging > folks to "do the right thing".
That's a sensible thought.
Show 9 quoted lines
>> I have to admit that the simplicity of strvec_pushv() nudged me towards >> using a NULL-terminated array here, though. So just having a >> strvec_pushvec() available could guide towards using the length-limited >> strvec instead of a simpler NULL-terminated array (which explodes if >> left unterminated). > > And that's not a huge issue by itself. I think the version you have here > is totally fine, and I won't insist on a reroll. But I think it gives us > a good opportunity to improve the status quo, if we want to take it.
Yeah, strvec_pushvec() might be a worthwhile thing to do, but that can come independent of this topic. The output from:
$ git grep -n -e strvec_pushv\(
is easy enough to look through to find which callers pass a strvec as the second parameter. It should be quite straightforward to find conversion candidates once the helper is actually implemented. It might even be possible to use Coccinelle for such a conversion.