@matheusbsbs / matheus-bagliano / commits / 150cd3b61d
Fork 0

commit-graph: fix "Writing out commit graph" progress counter

76ffbca71a (commit-graph: write Bloom filters to commit graph file, 2020-04-06) added two delayed progress lines to writing the Bloom filter index and data chunk. This is wrong, because a single common progress is used while writing all chunks, which is not updated while writing these two new chunks, resulting in incomplete-looking "done" lines: Expanding reachable commits in commit graph: 888679, done. Computing commit changed paths Bloom filters: 100% (888678/888678), done. Writing out commit graph in 6 passes: 66% (3554712/5332068), done. Use the common 'struct progress' instance while writing the Bloom filter chunks as well. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Jul 9, 2020 at 19:00 UTC 150cd3b61d55bedd275e0ed36a6f674dcd34ae25
1 file changed +2 -20
commit-graph.c
+2 -20
@@ -1086,23 +1086,14 @@ static void write_graph_chunk_bloom_indexes(struct hashfile *f,
1086 struct commit **list = ctx->commits.list;
1087 struct commit **last = ctx->commits.list + ctx->commits.nr;
1088 uint32_t cur_pos = 0;
1089 - struct progress *progress = NULL;
1090 - int i = 0;
1091 -
1092 - if (ctx->report_progress)
1093 - progress = start_delayed_progress(
1094 - _("Writing changed paths Bloom filters index"),
1095 - ctx->commits.nr);
1089
1090 while (list < last) {
1091 struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0);
1092 cur_pos += filter->len;
1100 - display_progress(progress, ++i);
1093 + display_progress(ctx->progress, ++ctx->progress_cnt);
1094 hashwrite_be32(f, cur_pos);
1095 list++;
1096 }
1104 -
1105 - stop_progress(&progress);
1097 }
1098
1099 static void write_graph_chunk_bloom_data(struct hashfile *f,
@@ -1111,13 +1102,6 @@ static void write_graph_chunk_bloom_data(struct hashfile *f,
1102 {
1103 struct commit **list = ctx->commits.list;
1104 struct commit **last = ctx->commits.list + ctx->commits.nr;
1114 - struct progress *progress = NULL;
1115 - int i = 0;
1116 -
1117 - if (ctx->report_progress)
1118 - progress = start_delayed_progress(
1119 - _("Writing changed paths Bloom filters data"),
1120 - ctx->commits.nr);
1105
1106 hashwrite_be32(f, settings->hash_version);
1107 hashwrite_be32(f, settings->num_hashes);
@@ -1125,12 +1109,10 @@ static void write_graph_chunk_bloom_data(struct hashfile *f,
1109
1110 while (list < last) {
1111 struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0);
1128 - display_progress(progress, ++i);
1112 + display_progress(ctx->progress, ++ctx->progress_cnt);
1113 hashwrite(f, filter->data, filter->len * sizeof(unsigned char));
1114 list++;
1115 }
1132 -
1133 - stop_progress(&progress);
1116 }
1117
1118 static int oid_compare(const void *_a, const void *_b)