Thread (45 messages) 45 messages, 10 authors, 2022-10-04

Re: [PATCH 2/6] remote-curl: add 'get' capability

From: Junio C Hamano <hidden>
Date: 2022-07-21 23:00:05

"Derrick Stolee via GitGitGadget" [off-list ref] 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 '<url> <path>', 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 <input 2>err &&
It has been a while since I worked with remote-http, but does this
need two $url?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help