diff options
author | Taylor Blau <me@ttaylorr.com> | 2023-04-13 00:20:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-13 16:55:45 +0200 |
commit | 65308ad8f757a823ccf3175609d580da5f767a15 (patch) | |
tree | 09c18147c49a87437f3ac7d7d9bcab78f92df5d3 /pack-revindex.c | |
parent | t5325: mark as leak-free (diff) | |
download | git-65308ad8f757a823ccf3175609d580da5f767a15.tar.xz git-65308ad8f757a823ccf3175609d580da5f767a15.zip |
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>
Diffstat (limited to 'pack-revindex.c')
-rw-r--r-- | pack-revindex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pack-revindex.c b/pack-revindex.c index 03c7e81f9d..e3d69cc0f7 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -283,7 +283,7 @@ cleanup: return ret; } -int load_pack_revindex(struct packed_git *p) +int load_pack_revindex(struct repository *r, struct packed_git *p) { if (p->revindex || p->revindex_data) return 0; @@ -356,7 +356,7 @@ int offset_to_pack_pos(struct packed_git *p, off_t ofs, uint32_t *pos) { unsigned lo, hi; - if (load_pack_revindex(p) < 0) + if (load_pack_revindex(the_repository, p) < 0) return -1; lo = 0; |