From: Nguyễn Thái Ngọc Duy Date: Fri, 16 Mar 2018 19:27:45 GMT Subject: [PATCH v3 7/7] pack-objects: display progress in get_object_details() Message-ID: <20180316192745.19557-8-pclouds@gmail.com> In-Reply-To: <20180316192745.19557-1-pclouds@gmail.com> This code is mostly about reading object headers, which is cheap. But when the number of objects is very large (e.g. 6.5M on linux-2.6.git) and the system is under memory pressure, this could take some time (86 seconds on my system). Show something during this time to let the user know pack-objects is still going strong. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/pack-objects.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index f74e9117f7..ac8f29dd52 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1715,6 +1715,10 @@ static void get_object_details(void) uint32_t i; struct object_entry **sorted_by_offset; + if (progress) + progress_state = start_progress(_("Getting object details"), + to_pack.nr_objects); + sorted_by_offset = xcalloc(to_pack.nr_objects, sizeof(struct object_entry *)); for (i = 0; i < to_pack.nr_objects; i++) sorted_by_offset[i] = to_pack.objects + i; @@ -1725,7 +1729,9 @@ static void get_object_details(void) check_object(entry); if (big_file_threshold < entry->size) entry->no_try_delta = 1; + display_progress(progress_state, i + 1); } + stop_progress(&progress_state); /* * This must happen in a second pass, since we rely on the delta -- 2.16.2.903.gd04caf5039