Skip to content

Commit

Permalink
bloom: parse commit before computing filters
Browse files Browse the repository at this point in the history
When computing changed-path Bloom filters for a commit, we need to
know if the commit has a parent or not. If the commit is not parsed,
then its parent pointer will be NULL.

As far as I can tell, the only opportunity to reach this code
without parsing the commit is inside "test-tool bloom
get_filter_for_commit" but it is best to be safe.

Signed-off-by: Derrick Stolee <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
derrickstolee authored and gitster committed May 11, 2020
1 parent 54c337b commit 891c17c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bloom.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ struct bloom_filter *get_bloom_filter(struct repository *r,
diffopt.max_changes = max_changes;
diff_setup_done(&diffopt);

/* ensure commit is parsed so we have parent information */
repo_parse_commit(r, c);

if (c->parents)
diff_tree_oid(&c->parents->item->object.oid, &c->object.oid, "", &diffopt);
else
Expand Down

0 comments on commit 891c17c

Please sign in to comment.