From: Eric Sunshine Date: Sun, 24 Sep 2023 06:52:19 GMT Subject: Re: [PATCH v2 3/3] archive: support remote archive from stateless transport Message-ID: In-Reply-To: <20230923152201.14741-4-worldhello.net@gmail.com> On Sat, Sep 23, 2023 at 11:22 AM Jiang Xin wrote: > Even though we can establish a stateless connection, we still cannot > archive the remote repository using a stateless HTTP protocol. Try the > following steps to make it work. > [...] > Signed-off-by: Jiang Xin > --- > diff --git a/http-backend.c b/http-backend.c > @@ -639,10 +640,19 @@ static void check_content_type(struct strbuf *hdr, const char *accepted_type) > - const char *argv[] = {NULL, "--stateless-rpc", ".", NULL}; > + const char *argv[4]; > > + if (!strcmp(service_name, "git-upload-archive")) { > + argv[1] = "."; > + argv[2] = NULL; > + } else { > + argv[1] = "--stateless-rpc"; > + argv[2] = "."; > + argv[3] = NULL; > + } It may not be worth a reroll, but since you're touching this code anyhow, these days we'd use `strvec` for this: struct strvec argv = STRVEC_INIT; if (strcmp(service_name, "git-upload-archive")) strvec_push(&argv, "--stateless-rpc"); strvec_push(&argv, ".");