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

5
http.h
View File

@@ -2,6 +2,7 @@
#define HTTP_H
struct packed_git;
struct packfile_list;
#include "git-zlib.h"
@@ -190,7 +191,7 @@ struct curl_slist *http_append_auth_header(const struct credential *c,
/* Helpers for fetching packs */
int http_get_info_packs(const char *base_url,
struct packed_git **packs_head);
struct packfile_list *packs);
/* Helper for getting Accept-Language header */
const char *http_get_accept_language_header(void);
@@ -226,7 +227,7 @@ void release_http_pack_request(struct http_pack_request *preq);
* from http_get_info_packs() and have chosen a specific pack to fetch.
*/
void http_install_packfile(struct packed_git *p,
struct packed_git **list_to_remove_from);
struct packfile_list *list_to_remove_from);
/* Helpers for fetching object */
struct http_object_request {