@matheusbsbs / matheus-bagliano / commits / cea69151a4
Fork 0

index-pack: restore "resolving deltas" progress meter

Commit f08cbf60fe (index-pack: make quantum of work smaller, 2020-09-08) refactored the main loop in threaded_second_pass(), but also deleted the call to display_progress() at the top of the loop. This means that users typically see no progress at all during the delta resolution phase (and for large repositories, Git appears to hang). This looks like an accident that was unrelated to the intended change of that commit, since we continue to update nr_resolved_deltas in resolve_delta(). Let's restore the call to get that progress back. We'll also add a test that confirms we generate the expected progress. This isn't perfect, as it wouldn't catch a bug where progress was delayed to the end. That was probably possible to trigger when receiving a thin pack, because we'd eventually call display_progress() from fix_unresolved_deltas(), but only once after doing all the work. However, since our test case generates a complete pack, it reliably demonstrates this particular bug and its fix. And we can't do better without making the test racy. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 7, 2020 at 14:19 UTC cea69151a4d4c0861a6dd5006267141b04ebbadb
2 files changed +11
builtin/index-pack.c
+4
@@ -1028,6 +1028,10 @@ static void *threaded_second_pass(void *data)
1028 struct object_entry *child_obj;
1029 struct base_data *child;
1030
1031 + counter_lock();
1032 + display_progress(progress, nr_resolved_deltas);
1033 + counter_unlock();
1034 +
1035 work_lock();
1036 if (list_empty(&work_head)) {
1037 /*
t/t5302-pack-index.sh
+7
@@ -277,4 +277,11 @@ test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in
277 grep "^warning:.* expected .tagger. line" err
278 '
279
280 +test_expect_success 'index-pack -v --stdin produces progress for both phases' '
281 + pack=$(git pack-objects --all pack </dev/null) &&
282 + GIT_PROGRESS_DELAY=0 git index-pack -v --stdin <pack-$pack.pack 2>err &&
283 + test_i18ngrep "Receiving objects" err &&
284 + test_i18ngrep "Resolving deltas" err
285 +'
286 +
287 test_done