aboutsummaryrefslogtreecommitdiffstats
path: root/http-push.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-10-30 11:38:40 +0100
committerJunio C Hamano <gitster@pobox.com>2025-10-30 07:09:52 -0700
commit89219bc0cd09ada8a204e0ace0bd15decaea7d31 (patch)
treec56034339260eb35f5859814598fa975a0e2b540 /http-push.c
parentf905a855b1d1e172ba1e51e03fc5ec531445575e (diff)
downloadgit-89219bc0cd09ada8a204e0ace0bd15decaea7d31.tar.gz
http: refactor subsystem to use `packfile_list`s
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>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/http-push.c b/http-push.c
index a1c01e3b9b..d86ce77119 100644
--- a/http-push.c
+++ b/http-push.c
@@ -104,7 +104,7 @@ struct repo {
int has_info_refs;
int can_update_info_refs;
int has_info_packs;
- struct packed_git *packs;
+ struct packfile_list packs;
struct remote_lock *locks;
};
@@ -311,7 +311,7 @@ static void start_fetch_packed(struct transfer_request *request)
struct transfer_request *check_request = request_queue_head;
struct http_pack_request *preq;
- target = find_oid_pack(&request->obj->oid, repo->packs);
+ target = packfile_list_find_oid(repo->packs.head, &request->obj->oid);
if (!target) {
fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid));
repo->can_update_info_refs = 0;
@@ -683,7 +683,7 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
get_remote_object_list(obj->oid.hash[0]);
if (obj->flags & (REMOTE | PUSHING))
return 0;
- target = find_oid_pack(&obj->oid, repo->packs);
+ target = packfile_list_find_oid(repo->packs.head, &obj->oid);
if (target) {
obj->flags |= REMOTE;
return 0;