pack-revindex: make load_pack_revindex take a repository

In a future commit, we will introduce a `pack.readReverseIndex`
configuration, which forces Git to generate the reverse index from
scratch instead of loading it from disk.

In order to avoid reading this configuration value more than once, we'll
use the `repo_settings` struct to lazily load this value.

In order to access the `struct repo_settings`, add a repository argument
to `load_pack_revindex`, and update all callers to pass the correct
instance (in all cases, `the_repository`).

In certain instances, a new function-local variable is introduced to
take the place of a `struct repository *` argument to the function
itself to avoid propagating the new parameter even further throughout
the tree.

Co-authored-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau
2023-04-12 18:20:24 -04:00
committed by Junio C Hamano
parent b77919ed6e
commit 65308ad8f7
4 changed files with 18 additions and 14 deletions

View File

@@ -39,6 +39,7 @@
struct packed_git;
struct multi_pack_index;
struct repository;
/*
* load_pack_revindex populates the revindex's internal data-structures for the
@@ -47,7 +48,7 @@ struct multi_pack_index;
* If a '.rev' file is present it is mmap'd, and pointers are assigned into it
* (instead of using the in-memory variant).
*/
int load_pack_revindex(struct packed_git *p);
int load_pack_revindex(struct repository *r, struct packed_git *p);
/*
* load_midx_revindex loads the '.rev' file corresponding to the given