From patchwork Wed May 8 12:44:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toon Claes X-Patchwork-Id: 13658680 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E970665BD1 for ; Wed, 8 May 2024 12:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172313; cv=none; b=G81nNYwKeVGIQ0edhgJZ76Tx7dKhnpzDKCxYuH9yGDHhpPLzl2QWZY0TeJR4JTiIfqiUIgjgNuoBxQgPt3X7sxEgqrGuBcFEiZKx1zi/tRjm/5Y/8DglEsOhFWVTpnHnvLTv3lY2AHSe8eEodT4te5fUz3GPw2xxxNO1OI6ki1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172313; c=relaxed/simple; bh=ang7xvGKhm3AsRN0AO+s0RZ9WpoB5PzcrvguBCWTv64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z5PcCi3+ovxoc5iqry6JpSiIeCEDlco1y7ybFyIMWgjOLDbRqrUO4mHzI07Fkla8KP2SPjM4JM5Pvn2TZTxvIBfH7yvNGIvPlgvHax2HDiVJKOdccLYnNxOLOz7/b/28t3djIp59dWV01K656PYZ2eQ8XvN6BiLlo6Q6wszZfB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com; spf=fail smtp.mailfrom=iotcl.com; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b=fm31wUIv; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=iotcl.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b="fm31wUIv" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iotcl.com; s=key1; t=1715172307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C0kir6kTaBL8aB4hqDzIa/JIYmbAwXC8yfn5loQ3F6Y=; b=fm31wUIv5rUWDebf96IJ2ehWWzsa0tj1yjlTidDHCviDgMbvw5g4mPF+9F9msfSLZEO/H5 eE414zRmlspLy+uZcy4yzXUmugpC6Po1f8viyazUneDASEnMZG/CsjkcTh3ekNlgzOb8DU KeNEiKIrbXOEDCI622e0mA/Pm07I+/4= From: Toon Claes To: git@vger.kernel.org Cc: Toon Claes Subject: [PATCH 1/4] progress: add function to set total Date: Wed, 8 May 2024 14:44:50 +0200 Message-ID: <20240508124453.600871-2-toon@iotcl.com> In-Reply-To: <20240508124453.600871-1-toon@iotcl.com> References: <20240508124453.600871-1-toon@iotcl.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT We're about to add the use of progress through curl. Although, curl doesn't know the total at the start of the download, but might receive this information in the Content-Length header when the download starts. To allow users set the total size after calling start_progress(), add a function progress_set_total(). Signed-off-by: Toon Claes --- progress.c | 6 ++++++ progress.h | 1 + t/helper/test-progress.c | 5 +++++ t/t0500-progress-display.sh | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/progress.c b/progress.c index c83cb60bf1..494b26eb20 100644 --- a/progress.c +++ b/progress.c @@ -271,6 +271,12 @@ static struct progress *start_progress_delay(const char *title, uint64_t total, return progress; } +void progress_set_total(struct progress *progress, uint64_t total) +{ + if (progress) + progress->total = total; +} + static int get_default_delay(void) { static int delay_in_secs = -1; diff --git a/progress.h b/progress.h index 3a945637c8..52f75ab1bf 100644 --- a/progress.h +++ b/progress.h @@ -14,6 +14,7 @@ void progress_test_force_update(void); void display_throughput(struct progress *progress, uint64_t total); void display_progress(struct progress *progress, uint64_t n); +void progress_set_total(struct progress *progress, uint64_t total); struct progress *start_progress(const char *title, uint64_t total); struct progress *start_sparse_progress(const char *title, uint64_t total); struct progress *start_delayed_progress(const char *title, uint64_t total); diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c index 66acb6a06c..622b1f738d 100644 --- a/t/helper/test-progress.c +++ b/t/helper/test-progress.c @@ -70,6 +70,11 @@ int cmd__progress(int argc, const char **argv) if (*end != '\0') die("invalid input: '%s'\n", line.buf); display_progress(progress, item_count); + } else if (skip_prefix(line.buf, "total ", (const char **) &end)) { + uint64_t total = strtoull(end, &end, 10); + if (*end != '\0') + die("invalid input: '%s'\n", line.buf); + progress_set_total(progress, total); } else if (skip_prefix(line.buf, "throughput ", (const char **) &end)) { uint64_t byte_count, test_ms; diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh index 1eb3a8306b..82a3b834a6 100755 --- a/t/t0500-progress-display.sh +++ b/t/t0500-progress-display.sh @@ -56,6 +56,30 @@ test_expect_success 'progress display with total' ' test_cmp expect out ' +test_expect_success 'progress display modify total' ' + cat >expect <<-\EOF && + Working hard: 1 + Working hard: 66% (2/3) + Working hard: 100% (3/3) + Working hard: 100% (3/3), done. + EOF + + cat >in <<-\EOF && + start 0 + update + progress 1 + update + total 3 + progress 2 + progress 3 + stop + EOF + test-tool progress stderr && + + show_cr out && + test_cmp expect out +' + test_expect_success 'progress display breaks long lines #1' ' sed -e "s/Z$//" >expect <<\EOF && Working hard.......2.........3.........4.........5.........6: 0% (100/100000) From patchwork Wed May 8 12:44:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toon Claes X-Patchwork-Id: 13658681 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB4866996F for ; Wed, 8 May 2024 12:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172314; cv=none; b=afKnQlfxbneoTH/xQ7ui+SP17Iq5qhUQ9L2rlypqsH+1bMYsCliRGZSVD0B1p8bf8N4/AE3IwcD5m0C0fRZuGXREVN/45GwsZqQYBOrxVp3T7IRnfQLwr2T+Sg67MowZ1YEZ6JyM1FVUNNNEjXZbh9pU4MlRE37ORqi/l3zos8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172314; c=relaxed/simple; bh=6rckbd8w7oe3qWSzPy1spgEU/AGb0TpnNHkmcWmUmfo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e5ibq/9WBpfocKrwaxh/0uIYOACnvNBS7YiWJaixhklxH+VMHa84GCQoezweNHQ8kJ2d1zuXte+UMld3I1jfiBLt+t48ecIj9QW2mI/t7fMCOf9FRVqGJWwLu//8l0Z/VW0tYsGR8MhWzHnFA/G+XLmLxnPfex6o+MSIGk5776w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com; spf=fail smtp.mailfrom=iotcl.com; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b=aZPrqnOE; arc=none smtp.client-ip=95.215.58.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=iotcl.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b="aZPrqnOE" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iotcl.com; s=key1; t=1715172310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRGVpwzTzrk9MbblF+MpKQqTCybqgPP2fi48nQ3hhVk=; b=aZPrqnOEusiB07bHAcncBmEV8v/vxBBxo2fwBOTifytGRWtWx/bOidOYkp0u50matK0hF+ P8vqWvcjfPoVsr8RsKKp/EV96aIgPcSEtBbAYitDC9Bdu/AaSFrtfLz4R5pBT23PKOHmaj picRCk+Ml8yrJieMK2YFJAOdg9PG6fc= From: Toon Claes To: git@vger.kernel.org Cc: Toon Claes Subject: [PATCH 2/4] http: add the ability to log progress Date: Wed, 8 May 2024 14:44:51 +0200 Message-ID: <20240508124453.600871-3-toon@iotcl.com> In-Reply-To: <20240508124453.600871-1-toon@iotcl.com> References: <20240508124453.600871-1-toon@iotcl.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Add an option `progress` to `struct http_get_options` to allow the caller to enable download progress using the progress.c API. Signed-off-by: Toon Claes Signed-off-by: Jeff King --- http.c | 32 ++++++++++++++++++++++++++++++++ http.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/http.c b/http.c index 3d80bd6116..15c5d53712 100644 --- a/http.c +++ b/http.c @@ -10,6 +10,7 @@ #include "credential.h" #include "version.h" #include "pkt-line.h" +#include "progress.h" #include "gettext.h" #include "trace.h" #include "transport.h" @@ -1457,6 +1458,9 @@ struct active_request_slot *get_active_slot(void) curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1); curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL); + curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(slot->curl, CURLOPT_XFERINFODATA, NULL); + curl_easy_setopt(slot->curl, CURLOPT_XFERINFOFUNCTION, NULL); /* * Default following to off unless "ALWAYS" is configured; this gives @@ -2017,6 +2021,21 @@ static void http_opt_request_remainder(CURL *curl, off_t pos) #define HTTP_REQUEST_STRBUF 0 #define HTTP_REQUEST_FILE 1 +static int http_progress_callback(void *clientp, curl_off_t dltotal, + curl_off_t dlnow, curl_off_t ultotal, + curl_off_t ulnow) +{ + struct progress *progress = clientp; + + if (progress) { + progress_set_total(progress, dltotal); + display_progress(progress, dlnow); + display_throughput(progress, dlnow); + } + + return 0; +} + static int http_request(const char *url, void *result, int target, const struct http_get_options *options) @@ -2025,6 +2044,7 @@ static int http_request(const char *url, struct slot_results results; struct curl_slist *headers = http_copy_default_headers(); struct strbuf buf = STRBUF_INIT; + struct progress *progress = NULL; const char *accept_language; int ret; @@ -2061,6 +2081,13 @@ static int http_request(const char *url, if (options && options->initial_request && http_follow_config == HTTP_FOLLOW_INITIAL) curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1); + if (options && options->progress) { + progress = start_progress(_("Downloading via HTTP"), 0); + + curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(slot->curl, CURLOPT_XFERINFODATA, progress); + curl_easy_setopt(slot->curl, CURLOPT_XFERINFOFUNCTION, &http_progress_callback); + } headers = curl_slist_append(headers, buf.buf); @@ -2079,6 +2106,11 @@ static int http_request(const char *url, ret = run_one_slot(slot, &results); + if (progress) { + curl_easy_setopt(slot->curl, CURLOPT_XFERINFODATA, NULL); + stop_progress(&progress); + } + if (options && options->content_type) { struct strbuf raw = STRBUF_INIT; curlinfo_strbuf(slot->curl, CURLINFO_CONTENT_TYPE, &raw); diff --git a/http.h b/http.h index 3af19a8bf5..37ecddec17 100644 --- a/http.h +++ b/http.h @@ -146,6 +146,11 @@ struct http_get_options { * request has completed. */ struct string_list *extra_headers; + + /* + * If not zero, display the progress. + */ + int progress; }; /* Return values for http_get_*() */ From patchwork Wed May 8 12:44:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toon Claes X-Patchwork-Id: 13658682 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56A7B73164 for ; Wed, 8 May 2024 12:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172316; cv=none; b=jK7qaBirtJ0sGocxIGkI2XMQObeN2HNdk9PvjPDhgbFV1M2LjxOhP85k6F23cbGhy8R+Aw9Bmd4VQMZUs7LneCEGYRW2zHgcoYXJN9XCeTmjOwDOQrgUv8mGGH5R0H+DloyBlrudBdOugd95G3bRUMkMfIZzbTRo2i+rTcM3tGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172316; c=relaxed/simple; bh=Sy6esTHw9LBvkqV8yx0KMoJJfnDWFiEG0dvA2VfCBlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K0zlPANBr+LozzfZrrrGlVP60y2PDZZP+ldjywaI+65EXjFedaByJyBAyNW+h8pTZtwQzv1a6BHe8M0dnBp2CQqju/vZRpsTqefm1B5jOLhAYzuStSxG3sgY0fAKl2IAwQUd03sAnyWb7KiJfuTksYoczeDgIL2jLAIwKhmq3CU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com; spf=fail smtp.mailfrom=iotcl.com; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b=VvHB40Et; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=iotcl.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b="VvHB40Et" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iotcl.com; s=key1; t=1715172312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sjlH5tYlBOzcsbkUJKs8pzOyJ10b6kTp0m3bZRQPkfg=; b=VvHB40EtpBajsRistXMw31t3aNKXtRA9kcLqSYNCP6e4yD6JxhWl43iroq+aU43hvrRr2d +4fARcRT2ejxNpxGj+DkMqZheQ6DKYUiBw0saFcG0zhQdRoZCZtmPUwhJHFQIGlOdPZWij GqOz6lGhpZODYHs52+KCeisPy9Gjx/4= From: Toon Claes To: git@vger.kernel.org Cc: Toon Claes Subject: [PATCH 3/4] remote-curl: optionally show progress for HTTP get Date: Wed, 8 May 2024 14:44:52 +0200 Message-ID: <20240508124453.600871-4-toon@iotcl.com> In-Reply-To: <20240508124453.600871-1-toon@iotcl.com> References: <20240508124453.600871-1-toon@iotcl.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT git-remote-curl supports the `option progress` basically since it's inception. But this option had no effect for regular HTTP(S) downloads. Add progress indicator when downloading files through curl HTTP GET. Signed-off-by: Toon Claes --- remote-curl.c | 8 +++++++- t/t5557-http-get.sh | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/remote-curl.c b/remote-curl.c index 0b6d7815fd..9fc7c3580c 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1293,6 +1293,7 @@ static void parse_get(const char *arg) { struct strbuf url = STRBUF_INIT; struct strbuf path = STRBUF_INIT; + struct http_get_options http_options = {0}; const char *space; space = strchr(arg, ' '); @@ -1303,7 +1304,12 @@ static void parse_get(const char *arg) strbuf_add(&url, arg, space - arg); strbuf_addstr(&path, space + 1); - if (http_get_file(url.buf, path.buf, NULL)) + http_options.initial_request = 1; + + if (options.progress) + http_options.progress = 1; + + if (http_get_file(url.buf, path.buf, &http_options)) die(_("failed to download file at URL '%s'"), url.buf); strbuf_release(&url); diff --git a/t/t5557-http-get.sh b/t/t5557-http-get.sh index 76a4bbd16a..92a138caaf 100755 --- a/t/t5557-http-get.sh +++ b/t/t5557-http-get.sh @@ -36,4 +36,19 @@ test_expect_success 'get by URL: 200' ' test_cmp "$HTTPD_DOCUMENT_ROOT_PATH/exists.txt" file2 ' +test_expect_success 'get by URL with progress' ' + echo hello >"$HTTPD_DOCUMENT_ROOT_PATH/hello.txt" && + + url="$HTTPD_URL/hello.txt" && + cat >input <<-EOF && + capabilities + option progress true + get $url file3 + + EOF + + git remote-http $url err && + test_grep "^Downloading via HTTP: 100%" err +' + test_done From patchwork Wed May 8 12:44:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toon Claes X-Patchwork-Id: 13658683 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C5F54F89 for ; Wed, 8 May 2024 12:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172318; cv=none; b=IdzcWlT+lvLRUCJnAPrtRC5MqvzXjuSayzbkOKos2fVjf0C5INlRKAdX1pRNUWxaFANKzanWMqGtLcfSfLj81xvEKAYT9KrWuKtn3XygKX7dBakH5/21yQ1ZIHkoZhWV/v/afhr2az49YRGZUp5jDMZ+B4KEA8RbAB+xlAxwUlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715172318; c=relaxed/simple; bh=LWJi03w94FMfI8yGXIPo0lPCIui3ifpgFThJUh9tW5U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RAr5eO2bBWfGT8lZjUs6X8fDl1sNrl6/Ug0sVIPDdAT8EtzpXMziF0FhO/jVgpE7g1IAT/7nMhzMju/zaTU5Mc8i98YFc9QIMGY+oWj9hTR/NMHjcS8MUTSjcPIxE3HXgzphKonVXev6d86/DLAPWujRKbH3mDv5XxkYWe4Zn8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com; spf=fail smtp.mailfrom=iotcl.com; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b=MpsQtC62; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=iotcl.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iotcl.com header.i=@iotcl.com header.b="MpsQtC62" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iotcl.com; s=key1; t=1715172315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7P9W7AEA4C8xAQeBDGGzZxOH9zzaVkQccMdG51jZydU=; b=MpsQtC62ghLYKUOojnJj+vqswbOZXaytqwFSsVbTSfvTbPm/FYUw9/xBTj0WXmJO+ddQxB N9H3Y7D4QCrSowb8kUtO9aw4EfFqUCKuaLq7V2NlX4w97gMoIwgpPs0McjC5+sPxJNqyRn r9NFZuoZakyxMO7yB56z9+UpsIVoWkc= From: Toon Claes To: git@vger.kernel.org Cc: Toon Claes Subject: [PATCH 4/4] bundle-uri: enable git-remote-https progress Date: Wed, 8 May 2024 14:44:53 +0200 Message-ID: <20240508124453.600871-5-toon@iotcl.com> In-Reply-To: <20240508124453.600871-1-toon@iotcl.com> References: <20240508124453.600871-1-toon@iotcl.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT When using bundle URIs large files might get downloaded during clone. During that time, there's no feedback to the user what is happening. Enable HTTP download progress for bundle URIs to inform the user. Signed-off-by: Toon Claes --- bundle-uri.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundle-uri.c b/bundle-uri.c index ca32050a78..462f00f668 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -293,7 +293,6 @@ static int download_https_uri_to_file(const char *file, const char *uri) int found_get = 0; strvec_pushl(&cp.args, "git-remote-https", uri, NULL); - cp.err = -1; cp.in = -1; cp.out = -1; @@ -328,6 +327,9 @@ static int download_https_uri_to_file(const char *file, const char *uri) goto cleanup; } + fprintf(child_in, "option progress true\n"); + fflush(child_in); + fprintf(child_in, "get %s %s\n\n", uri, file); cleanup: