Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] remote-curl: simplify passing of push specs
Date: Wed, 15 Jul 2026 08:41:08 +0200	[thread overview]
Message-ID: <alcrhGUCVMCnm2-i@pks.im> (raw)
In-Reply-To: <935883f3-3be4-4c51-9711-5208b9ef9ca1@web.de>

On Wed, Jul 15, 2026 at 06:41:17AM +0200, René Scharfe wrote:
> diff --git a/remote-curl.c b/remote-curl.c
> index 9e614c5567..2c35dd5240 100644
> --- a/remote-curl.c
> +++ b/remote-curl.c
> @@ -1340,10 +1340,9 @@ static void parse_get(const char *arg)
>  	fflush(stdout);
>  }
>  
> -static int push_dav(int nr_spec, const char **specs)
> +static int push_dav(const char **specs)
>  {
>  	struct child_process child = CHILD_PROCESS_INIT;
> -	size_t i;
>  
>  	child.git_cmd = 1;
>  	strvec_push(&child.args, "http-push");

I wonder whether the interface would be even better if we simply passed
around a `const struct strvec *` directly. That makes it explicit what
kind of guarantees we have, and all transitive callers already have one
available anyway.

> @@ -1353,15 +1352,14 @@ static int push_dav(int nr_spec, const char **specs)
>  	if (options.verbosity > 1)
>  		strvec_push(&child.args, "--verbose");
>  	strvec_push(&child.args, url.buf);
> -	for (i = 0; i < nr_spec; i++)
> -		strvec_push(&child.args, specs[i]);
> +	strvec_pushv(&child.args, specs);

I thought that we had something like `strvec_pushvec()` that knew to
also optimize for this case so that we don't have to reallocate the
vector multiple times. And if we had that function it would even be more
efficient to pass it down the stack. But we seemingly don't have it, so
that argument is kind of moot.

Other than those nits the patch looks good to me, thanks!

Patrick

      reply	other threads:[~2026-07-15  6:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  4:41 [PATCH] remote-curl: simplify passing of push specs René Scharfe
2026-07-15  6:41 ` Patrick Steinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alcrhGUCVMCnm2-i@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox