From: Junio C Hamano Date: Thu, 21 Jul 2022 22:59:56 GMT Subject: Re: [PATCH 2/6] remote-curl: add 'get' capability Message-ID: In-Reply-To: <977f0af40fc5cf3f0a7f167e2d2a47099168f47f.1654545325.git.gitgitgadget@gmail.com> "Derrick Stolee via GitGitGadget" writes: > +static void parse_get(struct strbuf *buf) > +{ > + struct http_get_options opts = { 0 }; > + struct strbuf url = STRBUF_INIT; > + struct strbuf path = STRBUF_INIT; > + const char *p, *space; > + > + if (!skip_prefix(buf->buf, "get ", &p)) > + die(_("http transport does not support %s"), buf->buf); > + > + space = strchr(p, ' '); > + > + if (!space) > + die(_("protocol error: expected ' ', missing space")); > + > + strbuf_add(&url, p, space - p); > + strbuf_addstr(&path, space + 1); > + > + if (http_get_file(url.buf, path.buf, &opts)) > + die(_("failed to download file at URL '%s'"), url.buf); Micronit: Do we plan to add some "interesting" options later to opts? Otherwise, the third parameter to http_get_file() can safely be NULL, I think. > + test_must_fail git remote-http $url $url err && It has been a while since I worked with remote-http, but does this need two $url?