summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-03-09 11:21:21 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-03-09 11:21:21 -0700
commit4a5c3e10f2a17efbbef72b7112d4d036ec89eceb (patch)
tree47d6632e0599c2298f146ad49b160a8636d748ab
parentMerge branch 'hd/show-one-mergetag-fix' (diff)
parentremote-curl: show progress for fetches over dumb HTTP (diff)
downloadtgif-4a5c3e10f2a17efbbef72b7112d4d036ec89eceb.tar.xz
Merge branch 'rs/show-progress-in-dumb-http-fetch'
"git fetch" over HTTP walker protocol did not show any progress output. We inherently do not know how much work remains, but still we can show something not to bore users. * rs/show-progress-in-dumb-http-fetch: remote-curl: show progress for fetches over dumb HTTP
-rw-r--r--remote-curl.c1
-rw-r--r--walker.c13
-rw-r--r--walker.h1
3 files changed, 14 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 8eb96152f5..e4cd321844 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1026,6 +1026,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
walker = get_http_walker(url.buf);
walker->get_verbosely = options.verbosity >= 3;
+ walker->get_progress = options.progress;
walker->get_recover = 0;
ret = walker_fetch(walker, nr_heads, targets, NULL, NULL);
walker_free(walker);
diff --git a/walker.c b/walker.c
index bb010f7a2b..4984bf8b3d 100644
--- a/walker.c
+++ b/walker.c
@@ -8,6 +8,7 @@
#include "tag.h"
#include "blob.h"
#include "refs.h"
+#include "progress.h"
static struct object_id current_commit_oid;
@@ -162,6 +163,11 @@ static int process(struct walker *walker, struct object *obj)
static int loop(struct walker *walker)
{
struct object_list *elem;
+ struct progress *progress = NULL;
+ uint64_t nr = 0;
+
+ if (walker->get_progress)
+ progress = start_delayed_progress(_("Fetching objects"), 0);
while (process_queue) {
struct object *obj = process_queue->item;
@@ -176,15 +182,20 @@ static int loop(struct walker *walker)
*/
if (! (obj->flags & TO_SCAN)) {
if (walker->fetch(walker, obj->oid.hash)) {
+ stop_progress(&progress);
report_missing(obj);
return -1;
}
}
if (!obj->type)
parse_object(the_repository, &obj->oid);
- if (process_object(walker, obj))
+ if (process_object(walker, obj)) {
+ stop_progress(&progress);
return -1;
+ }
+ display_progress(progress, ++nr);
}
+ stop_progress(&progress);
return 0;
}
diff --git a/walker.h b/walker.h
index 6d8ae00e5b..d40b016bab 100644
--- a/walker.h
+++ b/walker.h
@@ -10,6 +10,7 @@ struct walker {
int (*fetch)(struct walker *, unsigned char *sha1);
void (*cleanup)(struct walker *);
int get_verbosely;
+ int get_progress;
int get_recover;
int corrupt_object_found;