]> git.ipfire.org Git - thirdparty/git.git/commit - commit-graph.c
bloom: split 'get_bloom_filter()' in two
authorTaylor Blau <me@ttaylorr.com>
Wed, 16 Sep 2020 18:07:32 +0000 (14:07 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Sep 2020 16:31:25 +0000 (09:31 -0700)
commit312cff520742c933bde070be18c51c27e132cff1
treec3ede5bbf6ae9745ef609b0298f09f87e0ca7a49
parent97ffa4fab504a9c5e3b63ff886686c7f6ccd4e70
bloom: split 'get_bloom_filter()' in two

'get_bloom_filter' takes a flag to control whether it will compute a
Bloom filter if the requested one is missing. In the next patch, we'll
add yet another parameter to this method, which would force all but one
caller to specify an extra 'NULL' parameter at the end.

Instead of doing this, split 'get_bloom_filter' into two functions:
'get_bloom_filter' and 'get_or_compute_bloom_filter'. The former only
looks up a Bloom filter (and does not compute one if it's missing,
thus dropping the 'compute_if_not_present' flag). The latter does
compute missing Bloom filters, with an additional parameter to store
whether or not it needed to do so.

This simplifies many call-sites, since the majority of existing callers
to 'get_bloom_filter' do not want missing Bloom filters to be computed
(so they can drop the parameter entirely and use the simpler version of
the function).

While we're at it, instrument the new 'get_or_compute_bloom_filter()'
with counters in the 'write_commit_graph_context' struct which store
the number of filters that we did and didn't compute, as well as filters
that were truncated.

It would be nice to drop the 'compute_if_not_present' flag entirely,
since all remaining callers of 'get_or_compute_bloom_filter' pass it as
'1', but this will change in a future patch and hence cannot be removed.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
blame.c
bloom.c
bloom.h
commit-graph.c
line-log.c
revision.c
t/helper/test-bloom.c