summaryrefslogtreecommitdiff
path: root/walker.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2020-03-03 21:55:34 +0100
committerJunio C Hamano <gitster@pobox.com>2020-03-03 13:15:40 -0800
commit7655b4119d49844e6ebc62da571e5f18528dbde8 (patch)
treeeda6264cd28cf2439f8982708b2f46a22564b5e6 /walker.c
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
downloadgit-7655b4119d49844e6ebc62da571e5f18528dbde8.tar.gz
remote-curl: show progress for fetches over dumb HTTP
Fetching over dumb HTTP transport doesn't show any progress, even with the option --progress. If the connection is slow or there is a lot of data to get then this can take a long time while the user is left to wonder if git got stuck. We don't know the number of objects to fetch at the outset, but we can count the ones we got. Show an open-ended progress indicator based on that number if the user asked for it. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'walker.c')
-rw-r--r--walker.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/walker.c b/walker.c
index 06cd2bd569..6a579b230c 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;
}