Skip to content

Commit 891c17c

Browse files
derrickstoleegitster
authored andcommitted
bloom: parse commit before computing filters
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]>
1 parent 54c337b commit 891c17c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bloom.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ struct bloom_filter *get_bloom_filter(struct repository *r,
193193
diffopt.max_changes = max_changes;
194194
diff_setup_done(&diffopt);
195195

196+
/* ensure commit is parsed so we have parent information */
197+
repo_parse_commit(r, c);
198+
196199
if (c->parents)
197200
diff_tree_oid(&c->parents->item->object.oid, &c->object.oid, "", &diffopt);
198201
else

0 commit comments

Comments
 (0)