Skip to content

Commit cea6915

Browse files
peffgitster
authored andcommitted
index-pack: restore "resolving deltas" progress meter
Commit f08cbf6 (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 <[email protected]> Acked-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f08cbf6 commit cea6915

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

builtin/index-pack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,10 @@ static void *threaded_second_pass(void *data)
10281028
struct object_entry *child_obj;
10291029
struct base_data *child;
10301030

1031+
counter_lock();
1032+
display_progress(progress, nr_resolved_deltas);
1033+
counter_unlock();
1034+
10311035
work_lock();
10321036
if (list_empty(&work_head)) {
10331037
/*

t/t5302-pack-index.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,11 @@ test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in
277277
grep "^warning:.* expected .tagger. line" err
278278
'
279279

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+
280287
test_done

0 commit comments

Comments
 (0)