http: refactor subsystem to use packfile_lists

The dumb HTTP protocol directly fetches packfiles from the remote server
and temporarily stores them in a list of packfiles. Those packfiles are
not yet added to the repository's packfile store until we finalize the
whole fetch.

Refactor the code to instead use a `struct packfile_list` to store those
packs. This prepares us for a subsequent change where the `->next`
pointer of `struct packed_git` will go away.

Note that this refactoring creates some temporary duplication of code,
as we now have both `packfile_list_find_oid()` and `find_oid_pack()`.
The latter function will be removed in a subsequent commit though.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-10-30 11:38:40 +01:00
committed by Junio C Hamano
parent f905a855b1
commit 89219bc0cd
6 changed files with 40 additions and 35 deletions

View File

@@ -65,6 +65,14 @@ void packfile_list_remove(struct packfile_list *list, struct packed_git *pack);
void packfile_list_prepend(struct packfile_list *list, struct packed_git *pack);
void packfile_list_append(struct packfile_list *list, struct packed_git *pack);
/*
* Find the pack within the "packs" list whose index contains the object
* "oid". For general object lookups, you probably don't want this; use
* find_pack_entry() instead.
*/
struct packed_git *packfile_list_find_oid(struct packfile_list_entry *packs,
const struct object_id *oid);
/*
* A store that manages packfiles for a given object database.
*/