]> Kevux Git Server - rit/commit
midx: add repository to `multi_pack_index` struct
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 3 Dec 2024 14:44:03 +0000 (15:44 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Dec 2024 23:21:55 +0000 (08:21 +0900)
commite106040722c746346c3c40d3790789d9e196f60d
treea42675212de9a6305aa6032810df127c95f1ebdd
parentd284713bae71877577cf1a07501c8528f8c44bb2
midx: add repository to `multi_pack_index` struct

The `multi_pack_index` struct represents the MIDX for a repository.
Here, we add a pointer to the repository in this struct, allowing direct
use of the repository variable without relying on the global
`the_repository` struct.

With this addition, we can determine the repository associated with a
`bitmap_index` struct. A `bitmap_index` points to either a `packed_git`
or a `multi_pack_index`, both of which have direct repository
references. To support this, we introduce a static helper function,
`bitmap_repo`, in `pack-bitmap.c`, which retrieves a repository given a
`bitmap_index`.

With this, we clear up all usages of `the_repository` within
`pack-bitmap.c` and also remove the `USE_THE_REPOSITORY_VARIABLE`
definition. Bringing us another step closer to remove all global
variable usage.

Although this change also opens up the potential to clean up `midx.c`,
doing so would require additional refactoring to pass the repository
struct to functions where the MIDX struct is created: a task better
suited for future patches.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c
midx.h
pack-bitmap.c