mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
packfile: refactor get_all_packs() to work on packfile store
The `get_all_packs()` function prepares the packfile store and then returns its packfiles. Refactor it to accept a packfile store instead of a repository to clarify its scope. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
751808b2a1
commit
d2779beb36
@@ -603,18 +603,19 @@ static void get_head(struct strbuf *hdr, char *arg UNUSED)
|
||||
static void get_info_packs(struct strbuf *hdr, char *arg UNUSED)
|
||||
{
|
||||
size_t objdirlen = strlen(repo_get_object_directory(the_repository));
|
||||
struct packfile_store *packs = the_repository->objects->packfiles;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct packed_git *p;
|
||||
size_t cnt = 0;
|
||||
|
||||
select_getanyfile(hdr);
|
||||
for (p = get_all_packs(the_repository); p; p = p->next) {
|
||||
for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
|
||||
if (p->pack_local)
|
||||
cnt++;
|
||||
}
|
||||
|
||||
strbuf_grow(&buf, cnt * 53 + 2);
|
||||
for (p = get_all_packs(the_repository); p; p = p->next) {
|
||||
for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
|
||||
if (p->pack_local)
|
||||
strbuf_addf(&buf, "P %s\n", p->pack_name + objdirlen + 6);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user