Skip to content

Commit 4a5c3e1

Browse files
committed
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
2 parents 3658d77 + 7655b41 commit 4a5c3e1

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

remote-curl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
10261026

10271027
walker = get_http_walker(url.buf);
10281028
walker->get_verbosely = options.verbosity >= 3;
1029+
walker->get_progress = options.progress;
10291030
walker->get_recover = 0;
10301031
ret = walker_fetch(walker, nr_heads, targets, NULL, NULL);
10311032
walker_free(walker);

walker.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "tag.h"
99
#include "blob.h"
1010
#include "refs.h"
11+
#include "progress.h"
1112

1213
static struct object_id current_commit_oid;
1314

@@ -162,6 +163,11 @@ static int process(struct walker *walker, struct object *obj)
162163
static int loop(struct walker *walker)
163164
{
164165
struct object_list *elem;
166+
struct progress *progress = NULL;
167+
uint64_t nr = 0;
168+
169+
if (walker->get_progress)
170+
progress = start_delayed_progress(_("Fetching objects"), 0);
165171

166172
while (process_queue) {
167173
struct object *obj = process_queue->item;
@@ -176,15 +182,20 @@ static int loop(struct walker *walker)
176182
*/
177183
if (! (obj->flags & TO_SCAN)) {
178184
if (walker->fetch(walker, obj->oid.hash)) {
185+
stop_progress(&progress);
179186
report_missing(obj);
180187
return -1;
181188
}
182189
}
183190
if (!obj->type)
184191
parse_object(the_repository, &obj->oid);
185-
if (process_object(walker, obj))
192+
if (process_object(walker, obj)) {
193+
stop_progress(&progress);
186194
return -1;
195+
}
196+
display_progress(progress, ++nr);
187197
}
198+
stop_progress(&progress);
188199
return 0;
189200
}
190201

walker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct walker {
1010
int (*fetch)(struct walker *, unsigned char *sha1);
1111
void (*cleanup)(struct walker *);
1212
int get_verbosely;
13+
int get_progress;
1314
int get_recover;
1415

1516
int corrupt_object_found;

0 commit comments

Comments
 (0)