index-pack: show progress while checking objects

When 'git index-pack' is run by 'git clone', its check_objects() function usually doesn't take long enough to be a concern, but I just run into a situation where it took about a minute or so: I inadvertently put some memory pressure on my tiny laptop while cloning linux.git, and then there was quite a long silence between the "Resolving deltas" and "Checking connectivity" progress bars. Show a progress bar during the loop of check_objects() to let the user know that something is still going on. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Apr 1, 2019 at 01:12 UTC 79e3aa66244af40bd3c8999e00308f96748367d0
1 file changed +9 -1
builtin/index-pack.c
+9 -1
@@ -219,8 +219,16 @@ static unsigned check_objects(void)
219 unsigned i, max, foreign_nr = 0;
220
221 max = get_max_object_index();
222 - for (i = 0; i < max; i++)
222 +
223 + if (verbose)
224 + progress = start_delayed_progress(_("Checking objects"), max);
225 +
226 + for (i = 0; i < max; i++) {
227 foreign_nr += check_object(get_indexed_object(i));
228 + display_progress(progress, i + 1);
229 + }
230 +
231 + stop_progress(&progress);
232 return foreign_nr;
233 }
234