Skip to content

Commit ad60096

Browse files
wilbakergitster
authored andcommitted
midx: honor the MIDX_PROGRESS flag in verify_midx_file
Update verify_midx_file to only display progress when the MIDX_PROGRESS flag is set. Signed-off-by: William Baker <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8dc18f8 commit ad60096

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

midx.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,15 +1097,16 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
10971097
{
10981098
struct pair_pos_vs_id *pairs = NULL;
10991099
uint32_t i;
1100-
struct progress *progress;
1100+
struct progress *progress = NULL;
11011101
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
11021102
verify_midx_error = 0;
11031103

11041104
if (!m)
11051105
return 0;
11061106

1107-
progress = start_progress(_("Looking for referenced packfiles"),
1108-
m->num_packs);
1107+
if (flags & MIDX_PROGRESS)
1108+
progress = start_progress(_("Looking for referenced packfiles"),
1109+
m->num_packs);
11091110
for (i = 0; i < m->num_packs; i++) {
11101111
if (prepare_midx_pack(r, m, i))
11111112
midx_report("failed to load pack in position %d", i);
@@ -1123,8 +1124,9 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
11231124
i, oid_fanout1, oid_fanout2, i + 1);
11241125
}
11251126

1126-
progress = start_sparse_progress(_("Verifying OID order in MIDX"),
1127-
m->num_objects - 1);
1127+
if (flags & MIDX_PROGRESS)
1128+
progress = start_sparse_progress(_("Verifying OID order in multi-pack-index"),
1129+
m->num_objects - 1);
11281130
for (i = 0; i < m->num_objects - 1; i++) {
11291131
struct object_id oid1, oid2;
11301132

@@ -1151,13 +1153,15 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
11511153
pairs[i].pack_int_id = nth_midxed_pack_int_id(m, i);
11521154
}
11531155

1154-
progress = start_sparse_progress(_("Sorting objects by packfile"),
1155-
m->num_objects);
1156+
if (flags & MIDX_PROGRESS)
1157+
progress = start_sparse_progress(_("Sorting objects by packfile"),
1158+
m->num_objects);
11561159
display_progress(progress, 0); /* TODO: Measure QSORT() progress */
11571160
QSORT(pairs, m->num_objects, compare_pair_pos_vs_id);
11581161
stop_progress(&progress);
11591162

1160-
progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects);
1163+
if (flags & MIDX_PROGRESS)
1164+
progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects);
11611165
for (i = 0; i < m->num_objects; i++) {
11621166
struct object_id oid;
11631167
struct pack_entry e;

0 commit comments

Comments
 (0)