]> git.ipfire.org Git - thirdparty/git.git/commit
midx: introduce `bsearch_one_midx()`
authorTaylor Blau <me@ttaylorr.com>
Tue, 6 Aug 2024 15:37:30 +0000 (11:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Aug 2024 19:01:36 +0000 (12:01 -0700)
commit3f5f1cff92dfe64bbbfa9f2fb4ed810125810b1b
tree4bc0015be7250d54ab341a986dab37208e5cda25
parent60750e1eb967c8622e7140037ec018a87577132b
midx: introduce `bsearch_one_midx()`

The `bsearch_midx()` function will be extended in a following commit to
search for the location of a given object ID across all MIDXs in a chain
(or the single non-chain MIDX if no chain is available).

While most callers will naturally want to use the updated
`bsearch_midx()` function, there are a handful of special cases that
will want finer control and will only want to search through a single
MIDX.

For instance, the object abbreviation code, which cares about object IDs
near to where we'd expect to find a match in a MIDX. In that case, we
want to look at the nearby matches in each layer of the MIDX chain, not
just a single one).

Split the more fine-grained control out into a separate function called
`bsearch_one_midx()` which searches only a single MIDX.

At present both `bsearch_midx()` and `bsearch_one_midx()` have identical
behavior, but the following commit will rewrite the former to be aware
of incremental MIDXs for the remaining non-special case callers.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c
midx.h
object-name.c