Patrick Steinhardt <ps@xxxxxx> writes: > 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. > [snip] Nit: From running the clang formatter, small cleanups: diff --git a/builtin/gc.c b/builtin/gc.c index 030d0b0c77..41433b31ed 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1424,10 +1424,9 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED) for (p = packfile_store_get_packs(the_repository->objects->packfiles); count < incremental_repack_auto_limit && p; - p = p->next) { + p = p->next) if (!p->multi_pack_index) count++; - } return count >= incremental_repack_auto_limit; } @@ -1491,13 +1490,12 @@ static off_t get_auto_pack_size(void) struct repository *r = the_repository; odb_reprepare(r->objects); - for (p = packfile_store_get_packs(r->objects->packfiles); p; p = p->next) { + for (p = packfile_store_get_packs(r->objects->packfiles); p; p = p->next) if (p->pack_size > max_size) { second_largest_size = max_size; max_size = p->pack_size; } else if (p->pack_size > second_largest_size) second_largest_size = p->pack_size; - } result_size = second_largest_size + 1; diff --git a/http-backend.c b/http-backend.c index be4d8263a5..c5779db79d 100644 --- a/http-backend.c +++ b/http-backend.c @@ -608,16 +608,14 @@ static void get_info_packs(struct strbuf *hdr, char *arg UNUSED) size_t cnt = 0; select_getanyfile(hdr); - for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) { + for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) if (p->pack_local) cnt++; - } strbuf_grow(&buf, cnt * 53 + 2); - for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) { + for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) if (p->pack_local) strbuf_addf(&buf, "P %s\n", p->pack_name + objdirlen + 6); - } strbuf_addch(&buf, '\n'); hdr_nocache(hdr); diff --git a/http.c b/http.c index 16a1ab54f3..bf8711d6f8 100644 --- a/http.c +++ b/http.c @@ -2416,10 +2416,9 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head, * If we already have the pack locally, no need to fetch its index or * even add it to list; we already have all of its objects. */ - for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) { + for (p = packfile_store_get_packs(the_repository->objects->packfiles); p; p = p->next) if (hasheq(p->hash, sha1, the_repository->hash_algo)) return 0; - } tmp_idx = fetch_pack_index(sha1, base_url); if (!tmp_idx)
Attachment:
signature.asc
Description: PGP signature