aboutsummaryrefslogtreecommitdiffstats
path: root/http.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-03 07:27:57 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-03 07:27:57 -0800
commit1eb3440abd8b74b488685d123534580c7abb0352 (patch)
treebb224cef461c07d803521a55bc1efba0d250160d /http.c
parentMerge branch 'cc/fast-import-export-i18n-cleanup' into next (diff)
parentpackfile: track packs via the MRU list exclusively (diff)
downloadgit-1eb3440abd8b74b488685d123534580c7abb0352.tar.gz
git-1eb3440abd8b74b488685d123534580c7abb0352.zip
Merge branch 'ps/packed-git-in-object-store' into next
The list of packfiles used in a running Git process is moved from the packed_git structure into the packfile store. * ps/packed-git-in-object-store: packfile: track packs via the MRU list exclusively packfile: always add packfiles to MRU when adding a pack packfile: move list of packs into the packfile store builtin/pack-objects: simplify logic to find kept or nonlocal objects packfile: fix approximation of object counts http: refactor subsystem to use `packfile_list`s packfile: move the MRU list into the packfile store packfile: use a `strmap` to store packs by name
Diffstat (limited to 'http.c')
-rw-r--r--http.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/http.c b/http.c
index 17130823f0..41f850db16 100644
--- a/http.c
+++ b/http.c
@@ -2413,8 +2413,9 @@ static char *fetch_pack_index(unsigned char *hash, const char *base_url)
return tmp;
}
-static int fetch_and_setup_pack_index(struct packed_git **packs_head,
- unsigned char *sha1, const char *base_url)
+static int fetch_and_setup_pack_index(struct packfile_list *packs,
+ unsigned char *sha1,
+ const char *base_url)
{
struct packed_git *new_pack, *p;
char *tmp_idx = NULL;
@@ -2448,12 +2449,11 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head,
if (ret)
return -1;
- new_pack->next = *packs_head;
- *packs_head = new_pack;
+ packfile_list_prepend(packs, new_pack);
return 0;
}
-int http_get_info_packs(const char *base_url, struct packed_git **packs_head)
+int http_get_info_packs(const char *base_url, struct packfile_list *packs)
{
struct http_get_options options = {0};
int ret = 0;
@@ -2477,7 +2477,7 @@ int http_get_info_packs(const char *base_url, struct packed_git **packs_head)
!parse_oid_hex(data, &oid, &data) &&
skip_prefix(data, ".pack", &data) &&
(*data == '\n' || *data == '\0')) {
- fetch_and_setup_pack_index(packs_head, oid.hash, base_url);
+ fetch_and_setup_pack_index(packs, oid.hash, base_url);
} else {
data = strchrnul(data, '\n');
}
@@ -2541,14 +2541,9 @@ cleanup:
}
void http_install_packfile(struct packed_git *p,
- struct packed_git **list_to_remove_from)
+ struct packfile_list *list_to_remove_from)
{
- struct packed_git **lst = list_to_remove_from;
-
- while (*lst != p)
- lst = &((*lst)->next);
- *lst = (*lst)->next;
-
+ packfile_list_remove(list_to_remove_from, p);
packfile_store_add_pack(the_repository->objects->packfiles, p);
}