X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=walker.c;h=4984bf8b3d6658dc2571f66bd5142e67c0fe7d37;hb=12210859da0c16c644dab658d9e1ef671ec28788;hp=06cd2bd5691a5df247c9b07ca9a4cc3b58ed3912;hpb=43bf44e23a784f640f339f0647a248eb1b926ee6;p=thirdparty%2Fgit.git diff --git a/walker.c b/walker.c index 06cd2bd569..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; } @@ -261,12 +272,14 @@ int walker_fetch(struct walker *walker, int targets, char **target, struct strbuf refname = STRBUF_INIT; struct strbuf err = STRBUF_INIT; struct ref_transaction *transaction = NULL; - struct object_id *oids = xmalloc(targets * sizeof(struct object_id)); + struct object_id *oids; char *msg = NULL; int i, ret = -1; save_commit_buffer = 0; + ALLOC_ARRAY(oids, targets); + if (write_ref) { transaction = ref_transaction_begin(&err); if (!transaction) {