]> git.ipfire.org Git - thirdparty/git.git/commit
midx: replace `get_midx_rev_filename()` with a generic helper
authorTaylor Blau <me@ttaylorr.com>
Wed, 29 May 2024 22:55:42 +0000 (18:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 May 2024 20:43:52 +0000 (13:43 -0700)
commitdefba632c1e07eed360a8ba23df9103bbd1b7f9e
tree13c96e50981944bb940686dd546a4c08e81726bc
parentd6a8c58675a04abe2597179e3332bf031bd6e48a
midx: replace `get_midx_rev_filename()` with a generic helper

Commit f894081deae (pack-revindex: read multi-pack reverse indexes,
2021-03-30) introduced the `get_midx_rev_filename()` helper (later
modified by commit 60980aed786 (midx.c: write MIDX filenames to
strbuf, 2021-10-26)).

This function returns the location of the classic ".rev" files we used
to write for MIDXs (prior to 95e8383bac1 (midx.c: make changing the
preferred pack safe, 2022-01-25)), which is always of the form:

    $GIT_DIR/objects/pack/multi-pack-index-$HASH.rev

Replace this function with a generic helper that populates a strbuf with
the above form, replacing the ".rev" extension with a caller-provided
argument.

This will allow us to remove a similarly-defined function in the
pack-bitmap code (used to determine the location of a MIDX .bitmap file)
by reimplementing it in terms of `get_midx_filename_ext()`.

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