diff --git a/revision.c b/revision.c index 3628ef963d..b56608d144 100644 --- a/revision.c +++ b/revision.c @@ -789,6 +789,21 @@ bool revs_maybe_changed_in_bloom(struct rev_info *revs, return false; } +bool revs_maybe_changed_in_bloom_with_parents(struct rev_info *revs, + struct bloom_filter *filter) +{ + if (!revs->bloom_keyvecs_nr || !filter) + return true; + + for (size_t nr = 0; nr < revs->bloom_keyvecs_nr; nr++) + if (bloom_filter_contains_any_vec(filter, + revs->bloom_keyvecs[nr], + revs->bloom_filter_settings)) + return true; + + return false; +} + static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct commit *commit, int nth_parent) { diff --git a/revision.h b/revision.h index 14be39e20c..58b60f9b3e 100644 --- a/revision.h +++ b/revision.h @@ -505,6 +505,14 @@ int prepare_revision_walk(struct rev_info *revs); bool revs_maybe_changed_in_bloom(struct rev_info *revs, struct bloom_filter *filter); +/** + * Same as revs_maybe_changed_in_bloom(), but a change to any of the directories + * leading up to a path counts as well. Callers that track the tree entries + * containing the paths, and not just the paths themselves, need this. + */ +bool revs_maybe_changed_in_bloom_with_parents(struct rev_info *revs, + struct bloom_filter *filter); + /* Drain the commits linked list into the priority queue. */ void rev_info_commit_list_to_queue(struct rev_info *revs); /**