revision: move bloom keyvec precondition into function

There are currently two callsites calling check_maybe_different_in_bloom_filter(). They both check if revs->bloom_keyvecs_nr is not zero before they call that function. Move bloom_keyvecs_nr precondition into check_maybe_different_in_bloom_filter() to simplify the code. Note that this changes `bloom_ret` to become -1 when there are no Bloom key vectors, which results in `count_bloom_filter_false_positive` not being incremented. This is unobservable, as the Bloom statistics are only reported when key vectors were set up. Signed-off-by: Toon Claes <toon@iotcl.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Toon Claes committed Jul 17, 2026 at 17:46 UTC f751ee94c4dbd490eaa95bec83da9a383fd9acc4
1 file changed +5 -2
revision.c
+5 -2
@@ -752,6 +752,9 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,
752 struct bloom_filter *filter;
753 int result = 0;
754
755 + if (!revs->bloom_keyvecs_nr)
756 + return -1;
757 +
758 if (commit_graph_generation(commit) == GENERATION_NUMBER_INFINITY)
759 return -1;
760
@@ -806,7 +809,7 @@ static int rev_compare_tree(struct rev_info *revs,
809 return REV_TREE_SAME;
810 }
811
809 - if (revs->bloom_keyvecs_nr && !nth_parent) {
812 + if (!nth_parent) {
813 bloom_ret = check_maybe_different_in_bloom_filter(revs, commit);
814
815 if (bloom_ret == 0)
@@ -833,7 +836,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit,
836 if (!t1)
837 return 0;
838
836 - if (!nth_parent && revs->bloom_keyvecs_nr) {
839 + if (!nth_parent) {
840 bloom_ret = check_maybe_different_in_bloom_filter(revs, commit);
841 if (!bloom_ret)
842 return 1;