mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
midx: drop redundant struct repository parameter
There are a couple of functions that take both a `struct repository` and a `struct multi_pack_index`. This provides redundant information though without much benefit given that the multi-pack index already has a pointer to its owning repository. Drop the `struct repository` parameter from such functions. While at it, reorder the list of parameters of `fill_midx_entry()` so that the MIDX comes first to better align with our coding guidelines. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
57363dfa0d
commit
9ff2129615
18
midx.c
18
midx.c
@@ -450,9 +450,10 @@ static uint32_t midx_for_pack(struct multi_pack_index **_m,
|
||||
return pack_int_id - m->num_packs_in_base;
|
||||
}
|
||||
|
||||
int prepare_midx_pack(struct repository *r, struct multi_pack_index *m,
|
||||
int prepare_midx_pack(struct multi_pack_index *m,
|
||||
uint32_t pack_int_id)
|
||||
{
|
||||
struct repository *r = m->repo;
|
||||
struct strbuf pack_name = STRBUF_INIT;
|
||||
struct strbuf key = STRBUF_INIT;
|
||||
struct packed_git *p;
|
||||
@@ -507,7 +508,7 @@ struct packed_git *nth_midxed_pack(struct multi_pack_index *m,
|
||||
|
||||
#define MIDX_CHUNK_BITMAPPED_PACKS_WIDTH (2 * sizeof(uint32_t))
|
||||
|
||||
int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
|
||||
int nth_bitmapped_pack(struct multi_pack_index *m,
|
||||
struct bitmapped_pack *bp, uint32_t pack_int_id)
|
||||
{
|
||||
uint32_t local_pack_int_id = midx_for_pack(&m, pack_int_id);
|
||||
@@ -515,7 +516,7 @@ int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
|
||||
if (!m->chunk_bitmapped_packs)
|
||||
return error(_("MIDX does not contain the BTMP chunk"));
|
||||
|
||||
if (prepare_midx_pack(r, m, pack_int_id))
|
||||
if (prepare_midx_pack(m, pack_int_id))
|
||||
return error(_("could not load bitmapped pack %"PRIu32), pack_int_id);
|
||||
|
||||
bp->p = m->packs[local_pack_int_id];
|
||||
@@ -600,10 +601,9 @@ uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos)
|
||||
(off_t)pos * MIDX_CHUNK_OFFSET_WIDTH);
|
||||
}
|
||||
|
||||
int fill_midx_entry(struct repository *r,
|
||||
int fill_midx_entry(struct multi_pack_index *m,
|
||||
const struct object_id *oid,
|
||||
struct pack_entry *e,
|
||||
struct multi_pack_index *m)
|
||||
struct pack_entry *e)
|
||||
{
|
||||
uint32_t pos;
|
||||
uint32_t pack_int_id;
|
||||
@@ -615,7 +615,7 @@ int fill_midx_entry(struct repository *r,
|
||||
midx_for_object(&m, pos);
|
||||
pack_int_id = nth_midxed_pack_int_id(m, pos);
|
||||
|
||||
if (prepare_midx_pack(r, m, pack_int_id))
|
||||
if (prepare_midx_pack(m, pack_int_id))
|
||||
return 0;
|
||||
p = m->packs[pack_int_id - m->num_packs_in_base];
|
||||
|
||||
@@ -912,7 +912,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
|
||||
_("Looking for referenced packfiles"),
|
||||
m->num_packs + m->num_packs_in_base);
|
||||
for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) {
|
||||
if (prepare_midx_pack(r, m, i))
|
||||
if (prepare_midx_pack(m, i))
|
||||
midx_report("failed to load pack in position %d", i);
|
||||
|
||||
display_progress(progress, i + 1);
|
||||
@@ -989,7 +989,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
|
||||
|
||||
nth_midxed_object_oid(&oid, m, pairs[i].pos);
|
||||
|
||||
if (!fill_midx_entry(r, &oid, &e, m)) {
|
||||
if (!fill_midx_entry(m, &oid, &e)) {
|
||||
midx_report(_("failed to load pack entry for oid[%d] = %s"),
|
||||
pairs[i].pos, oid_to_hex(&oid));
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user