Skip to content

Commit

Permalink
commit-graph: fix "Writing out commit graph" progress counter
Browse files Browse the repository at this point in the history
76ffbca (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>
  • Loading branch information
szeder authored and gitster committed Jul 9, 2020
1 parent 6f9d5f2 commit 150cd3b
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions commit-graph.c
Expand Up @@ -1086,23 +1086,14 @@ static void write_graph_chunk_bloom_indexes(struct hashfile *f,
struct commit **list = ctx->commits.list;
struct commit **last = ctx->commits.list + ctx->commits.nr;
uint32_t cur_pos = 0;
struct progress *progress = NULL;
int i = 0;

if (ctx->report_progress)
progress = start_delayed_progress(
_("Writing changed paths Bloom filters index"),
ctx->commits.nr);

while (list < last) {
struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0);
cur_pos += filter->len;
display_progress(progress, ++i);
display_progress(ctx->progress, ++ctx->progress_cnt);
hashwrite_be32(f, cur_pos);
list++;
}

stop_progress(&progress);
}

static void write_graph_chunk_bloom_data(struct hashfile *f,
Expand All @@ -1111,26 +1102,17 @@ static void write_graph_chunk_bloom_data(struct hashfile *f,
{
struct commit **list = ctx->commits.list;
struct commit **last = ctx->commits.list + ctx->commits.nr;
struct progress *progress = NULL;
int i = 0;

if (ctx->report_progress)
progress = start_delayed_progress(
_("Writing changed paths Bloom filters data"),
ctx->commits.nr);

hashwrite_be32(f, settings->hash_version);
hashwrite_be32(f, settings->num_hashes);
hashwrite_be32(f, settings->bits_per_entry);

while (list < last) {
struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0);
display_progress(progress, ++i);
display_progress(ctx->progress, ++ctx->progress_cnt);
hashwrite(f, filter->data, filter->len * sizeof(unsigned char));
list++;
}

stop_progress(&progress);
}

static int oid_compare(const void *_a, const void *_b)
Expand Down

0 comments on commit 150cd3b

Please sign in to comment.