Skip to content

Commit efdd2f0

Browse files
derrickstoleegitster
authored andcommitted
midx: use start_delayed_progress()
Now that the multi-pack-index may be written as part of auto maintenance at the end of a command, reduce the progress output when the operations are quick. Use start_delayed_progress() instead of start_progress(). Update t5319-multi-pack-index.sh to use GIT_PROGRESS_DELAY=0 now that the progress indicators are conditional. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18e449f commit efdd2f0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

midx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
832832

833833
packs.pack_paths_checked = 0;
834834
if (flags & MIDX_PROGRESS)
835-
packs.progress = start_progress(_("Adding packfiles to multi-pack-index"), 0);
835+
packs.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0);
836836
else
837837
packs.progress = NULL;
838838

@@ -969,7 +969,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
969969
}
970970

971971
if (flags & MIDX_PROGRESS)
972-
progress = start_progress(_("Writing chunks to multi-pack-index"),
972+
progress = start_delayed_progress(_("Writing chunks to multi-pack-index"),
973973
num_chunks);
974974
for (i = 0; i < num_chunks; i++) {
975975
if (written != chunk_offsets[i])
@@ -1104,7 +1104,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
11041104
return 0;
11051105

11061106
if (flags & MIDX_PROGRESS)
1107-
progress = start_progress(_("Looking for referenced packfiles"),
1107+
progress = start_delayed_progress(_("Looking for referenced packfiles"),
11081108
m->num_packs);
11091109
for (i = 0; i < m->num_packs; i++) {
11101110
if (prepare_midx_pack(r, m, i))
@@ -1225,7 +1225,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
12251225
count = xcalloc(m->num_packs, sizeof(uint32_t));
12261226

12271227
if (flags & MIDX_PROGRESS)
1228-
progress = start_progress(_("Counting referenced objects"),
1228+
progress = start_delayed_progress(_("Counting referenced objects"),
12291229
m->num_objects);
12301230
for (i = 0; i < m->num_objects; i++) {
12311231
int pack_int_id = nth_midxed_pack_int_id(m, i);
@@ -1235,7 +1235,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
12351235
stop_progress(&progress);
12361236

12371237
if (flags & MIDX_PROGRESS)
1238-
progress = start_progress(_("Finding and deleting unreferenced packfiles"),
1238+
progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"),
12391239
m->num_packs);
12401240
for (i = 0; i < m->num_packs; i++) {
12411241
char *pack_name;

t/t5319-multi-pack-index.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ test_expect_success 'write progress off for redirected stderr' '
171171
'
172172

173173
test_expect_success 'write force progress on for stderr' '
174-
git multi-pack-index --object-dir=$objdir --progress write 2>err &&
174+
GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --progress write 2>err &&
175175
test_file_not_empty err
176176
'
177177

178178
test_expect_success 'write with the --no-progress option' '
179-
git multi-pack-index --object-dir=$objdir --no-progress write 2>err &&
179+
GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --no-progress write 2>err &&
180180
test_line_count = 0 err
181181
'
182182

@@ -333,17 +333,17 @@ test_expect_success 'git-fsck incorrect offset' '
333333
'
334334

335335
test_expect_success 'repack progress off for redirected stderr' '
336-
git multi-pack-index --object-dir=$objdir repack 2>err &&
336+
GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir repack 2>err &&
337337
test_line_count = 0 err
338338
'
339339

340340
test_expect_success 'repack force progress on for stderr' '
341-
git multi-pack-index --object-dir=$objdir --progress repack 2>err &&
341+
GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --progress repack 2>err &&
342342
test_file_not_empty err
343343
'
344344

345345
test_expect_success 'repack with the --no-progress option' '
346-
git multi-pack-index --object-dir=$objdir --no-progress repack 2>err &&
346+
GIT_PROGRESS_DELAY=0 git multi-pack-index --object-dir=$objdir --no-progress repack 2>err &&
347347
test_line_count = 0 err
348348
'
349349

@@ -487,15 +487,15 @@ test_expect_success 'expire progress off for redirected stderr' '
487487
test_expect_success 'expire force progress on for stderr' '
488488
(
489489
cd dup &&
490-
git multi-pack-index --progress expire 2>err &&
490+
GIT_PROGRESS_DELAY=0 git multi-pack-index --progress expire 2>err &&
491491
test_file_not_empty err
492492
)
493493
'
494494

495495
test_expect_success 'expire with the --no-progress option' '
496496
(
497497
cd dup &&
498-
git multi-pack-index --no-progress expire 2>err &&
498+
GIT_PROGRESS_DELAY=0 git multi-pack-index --no-progress expire 2>err &&
499499
test_line_count = 0 err
500500
)
501501
'

0 commit comments

Comments
 (0)