From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 1ABC21F404 for ; Sat, 24 Feb 2018 00:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752294AbeBXAsL (ORCPT ); Fri, 23 Feb 2018 19:48:11 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39158 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbeBXAsH (ORCPT ); Fri, 23 Feb 2018 19:48:07 -0500 Received: by mail-pl0-f68.google.com with SMTP id s13so5843910plq.6 for ; Fri, 23 Feb 2018 16:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yWCYQx6zDcqwzv+UtCnaCRIrSLdX9QBFR9U3UoU20nQ=; b=CDOi7YTX3f9i7cfyNKCgFCABQm+c9OobA/5y41rnPqQqmjThZSXsXDM4fIJM8d+z1i K5GC1B/N0+O/fCEp9pfrAgB0hGYcNJta/bzhxK+2AFTsaEc6QxL9v4d3gAeDRxiPBUwS sMjGVvKXeijc//kMqh7X76ISTZE0FEeif2kqT6/UyZ0OuUX7t9BF1qf3Jp98EMByWTsM Kl8H9pdO898/d6xtAje2zHByYq47kNoDvF9VZfTHR4+Q/3z64JcqhEyTYp2aOisEmq00 56JFoi3cd5KcNWQ5gRgcDq7fwgkOuwS12XnKbXybyg3dTZthed5QbgGKgf+sf1VyRBze 9ctQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yWCYQx6zDcqwzv+UtCnaCRIrSLdX9QBFR9U3UoU20nQ=; b=QcZEACWJmpnjH428DdS9eEe0oQ0AcHy4O0cLpsHE0mVLZrVNYpiSR0HnwzaS/XhGmS B5YFVg1FA6boZOT98jfm4hEPMuQUUH1Nk6wre2xHVZzBf+92NHVIYrWOBqa5KxIUDyZE dyA1tmONrAxYMno7bt1jMl8huu1xyMHyKLxpsvAcgl1xpeQqO6mFtzmm0H8cgtf+m652 TMk57s/cTeq5mtP8EEMW8rJSq/IXmkmVr22OlnIznobHFQLv7yveaczwRodXw2V+fATw HDYV8aRhL8vz0HW3wjD9A8zxrcWsl1UcCGQPTazb8dZ1L1V5OtWek59B1gAsuzIqGhLW Pnmw== X-Gm-Message-State: APf1xPBVDMAeFAUk29pGLeiLzLB8JudEQjOnS2rci0gYf4kSJKgq1tpw HmEHxf88hQVxp7xR7Ro3hKvYkURBHY8= X-Google-Smtp-Source: AH8x2240b0Lq1Rsnbo7IwpVmOXyW7d8IIAQwOzn+PhLoMAlHPS6fbN72Y982u6c+arjAA1bDYes+Zw== X-Received: by 2002:a17:902:b109:: with SMTP id q9-v6mr3410687plr.340.1519433285927; Fri, 23 Feb 2018 16:48:05 -0800 (PST) Received: from localhost ([2620:0:100e:422:2d12:5719:3437:fdb7]) by smtp.gmail.com with ESMTPSA id e81sm6932323pfb.58.2018.02.23.16.48.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Feb 2018 16:48:05 -0800 (PST) From: Stefan Beller To: sbeller@google.com Cc: git@vger.kernel.org, gitster@pobox.com, jonathantanmy@google.com, pclouds@gmail.com, sunshine@sunshineco.com, bmwill@google.com, Jonathan Nieder Subject: [PATCHv4 05/27] object-store: move packed_git and packed_git_mru to object store Date: Fri, 23 Feb 2018 16:47:32 -0800 Message-Id: <20180224004754.129721-6-sbeller@google.com> X-Mailer: git-send-email 2.16.1.291.g4437f3f132-goog In-Reply-To: <20180224004754.129721-1-sbeller@google.com> References: <20180221015430.96054-1-sbeller@google.com> <20180224004754.129721-1-sbeller@google.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a process with multiple repositories open, packfile accessors should be associated to a single repository and not shared globally. Move packed_git and packed_git_mru into the_repository and adjust callers to reflect this. Patch generated by 1. Moving the struct packed_git declaration to object-store.h and packed_git, packed_git_mru globals to struct object_store. 2. Apply the following semantic patch to adjust callers: @@ @@ - packed_git + the_repository->objects.packed_git @@ @@ - packed_git_mru + the_repository->objects.packed_git_mru 3. Applying line wrapping fixes from "make style" to break the resulting long lines. 4. Adding missing #includes of repository.h where needed. 5. As the packfiles are now owned by an objectstore, which is ephemeral unlike globals, we introduce memory leaks. So address them in raw_object_store_clear(). Defer freeing packed_git to the next patch due to the size of this patch. Signed-off-by: Stefan Beller Signed-off-by: Jonathan Nieder --- builtin/count-objects.c | 5 +++-- builtin/fsck.c | 6 ++++-- builtin/gc.c | 3 ++- builtin/pack-objects.c | 20 +++++++++++--------- builtin/pack-redundant.c | 5 +++-- cache.h | 29 ----------------------------- fast-import.c | 7 +++++-- http-backend.c | 5 +++-- object-store.h | 31 ++++++++++++++++++++++++++++++- object.c | 6 ++++++ pack-bitmap.c | 3 ++- packfile.c | 39 ++++++++++++++++++++------------------- repository.c | 4 +++- server-info.c | 5 +++-- sha1_name.c | 5 +++-- 15 files changed, 98 insertions(+), 75 deletions(-) diff --git a/builtin/count-objects.c b/builtin/count-objects.c index 33343818c83..6aab8d08fcc 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -7,6 +7,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "repository.h" #include "builtin.h" #include "parse-options.h" #include "quote.h" @@ -120,9 +121,9 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) struct strbuf loose_buf = STRBUF_INIT; struct strbuf pack_buf = STRBUF_INIT; struct strbuf garbage_buf = STRBUF_INIT; - if (!packed_git) + if (!the_repository->objects.packed_git) prepare_packed_git(); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (!p->pack_local) continue; if (open_pack_index(p)) diff --git a/builtin/fsck.c b/builtin/fsck.c index 78edcb75c45..c3a339193c8 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -735,7 +735,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) prepare_packed_git(); if (show_progress) { - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; + p = p->next) { if (open_pack_index(p)) continue; total += p->num_objects; @@ -743,7 +744,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) progress = start_progress(_("Checking objects"), total); } - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; + p = p->next) { /* verify gives error messages itself */ if (verify_pack(p, fsck_obj_buffer, progress, count)) diff --git a/builtin/gc.c b/builtin/gc.c index 77fa720bd0b..59bf5c2ea0b 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -11,6 +11,7 @@ */ #include "builtin.h" +#include "repository.h" #include "config.h" #include "tempfile.h" #include "lockfile.h" @@ -173,7 +174,7 @@ static int too_many_packs(void) return 0; prepare_packed_git(); - for (cnt = 0, p = packed_git; p; p = p->next) { + for (cnt = 0, p = the_repository->objects.packed_git; p; p = p->next) { if (!p->pack_local) continue; if (p->pack_keep) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 5c674b2843c..a64005760be 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "repository.h" #include "config.h" #include "attr.h" #include "object.h" @@ -1025,8 +1026,7 @@ static int want_object_in_pack(const struct object_id *oid, if (want != -1) return want; } - - list_for_each(pos, &packed_git_mru) { + list_for_each(pos, &the_repository->objects.packed_git_mru) { struct packed_git *p = list_entry(pos, struct packed_git, mru); off_t offset; @@ -1044,7 +1044,8 @@ static int want_object_in_pack(const struct object_id *oid, } want = want_found_object(exclude, p); if (!exclude && want > 0) - list_move(&p->mru, &packed_git_mru); + list_move(&p->mru, + &the_repository->objects.packed_git_mru); if (want != -1) return want; } @@ -2673,7 +2674,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs) memset(&in_pack, 0, sizeof(in_pack)); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { struct object_id oid; struct object *o; @@ -2736,7 +2737,8 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid) static struct packed_git *last_found = (void *)1; struct packed_git *p; - p = (last_found != (void *)1) ? last_found : packed_git; + p = (last_found != (void *)1) ? last_found : + the_repository->objects.packed_git; while (p) { if ((!p->pack_local || p->pack_keep) && @@ -2745,7 +2747,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid) return 1; } if (p == last_found) - p = packed_git; + p = the_repository->objects.packed_git; else p = p->next; if (p == last_found) @@ -2781,7 +2783,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs) uint32_t i; struct object_id oid; - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (!p->pack_local || p->pack_keep) continue; @@ -3152,7 +3154,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) prepare_packed_git(); if (ignore_packed_keep) { struct packed_git *p; - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) if (p->pack_local && p->pack_keep) break; if (!p) /* no keep-able packs found */ @@ -3165,7 +3167,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) * also covers non-local objects */ struct packed_git *p; - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (!p->pack_local) { have_non_local_packs = 1; break; diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index aaa81363222..a196fae79d4 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -7,6 +7,7 @@ */ #include "builtin.h" +#include "repository.h" #include "packfile.h" #define BLKSIZE 512 @@ -571,7 +572,7 @@ static struct pack_list * add_pack(struct packed_git *p) static struct pack_list * add_pack_file(const char *filename) { - struct packed_git *p = packed_git; + struct packed_git *p = the_repository->objects.packed_git; if (strlen(filename) < 40) die("Bad pack filename: %s", filename); @@ -586,7 +587,7 @@ static struct pack_list * add_pack_file(const char *filename) static void load_all(void) { - struct packed_git *p = packed_git; + struct packed_git *p = the_repository->objects.packed_git; while (p) { add_pack(p); diff --git a/cache.h b/cache.h index 99eb2bdb893..63889acb591 100644 --- a/cache.h +++ b/cache.h @@ -1569,35 +1569,6 @@ struct pack_window { unsigned int inuse_cnt; }; -extern struct packed_git { - struct packed_git *next; - struct list_head mru; - struct pack_window *windows; - off_t pack_size; - const void *index_data; - size_t index_size; - uint32_t num_objects; - uint32_t num_bad_objects; - unsigned char *bad_object_sha1; - int index_version; - time_t mtime; - int pack_fd; - unsigned pack_local:1, - pack_keep:1, - freshened:1, - do_not_close:1, - pack_promisor:1; - unsigned char sha1[20]; - struct revindex_entry *revindex; - /* something like ".git/objects/pack/xxxxx.pack" */ - char pack_name[FLEX_ARRAY]; /* more */ -} *packed_git; - -/* - * A most-recently-used ordered version of the packed_git list. - */ -extern struct list_head packed_git_mru; - struct pack_entry { off_t offset; unsigned char sha1[20]; diff --git a/fast-import.c b/fast-import.c index 0f818cd9328..3d7002d1cd6 100644 --- a/fast-import.c +++ b/fast-import.c @@ -154,6 +154,7 @@ Format of STDIN stream: #include "builtin.h" #include "cache.h" +#include "repository.h" #include "config.h" #include "lockfile.h" #include "object.h" @@ -1110,7 +1111,8 @@ static int store_object( if (e->idx.offset) { duplicate_count_by_type[type]++; return 1; - } else if (find_sha1_pack(oid.hash, packed_git)) { + } else if (find_sha1_pack(oid.hash, + the_repository->objects.packed_git)) { e->type = type; e->pack_id = MAX_PACK_ID; e->idx.offset = 1; /* just not zero! */ @@ -1307,7 +1309,8 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) duplicate_count_by_type[OBJ_BLOB]++; truncate_pack(&checkpoint); - } else if (find_sha1_pack(oid.hash, packed_git)) { + } else if (find_sha1_pack(oid.hash, + the_repository->objects.packed_git)) { e->type = OBJ_BLOB; e->pack_id = MAX_PACK_ID; e->idx.offset = 1; /* just not zero! */ diff --git a/http-backend.c b/http-backend.c index f3dc218b2a3..85b6a97923f 100644 --- a/http-backend.c +++ b/http-backend.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "repository.h" #include "refs.h" #include "pkt-line.h" #include "object.h" @@ -518,13 +519,13 @@ static void get_info_packs(struct strbuf *hdr, char *arg) select_getanyfile(hdr); prepare_packed_git(); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (p->pack_local) cnt++; } strbuf_grow(&buf, cnt * 53 + 2); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (p->pack_local) strbuf_addf(&buf, "P %s\n", p->pack_name + objdirlen + 6); } diff --git a/object-store.h b/object-store.h index e78eea1dde3..4f768465a14 100644 --- a/object-store.h +++ b/object-store.h @@ -52,6 +52,30 @@ void add_to_alternates_memory(const char *dir); */ struct strbuf *alt_scratch_buf(struct alternate_object_database *alt); +struct packed_git { + struct packed_git *next; + struct list_head mru; + struct pack_window *windows; + off_t pack_size; + const void *index_data; + size_t index_size; + uint32_t num_objects; + uint32_t num_bad_objects; + unsigned char *bad_object_sha1; + int index_version; + time_t mtime; + int pack_fd; + unsigned pack_local:1, + pack_keep:1, + freshened:1, + do_not_close:1, + pack_promisor:1; + unsigned char sha1[20]; + struct revindex_entry *revindex; + /* something like ".git/objects/pack/xxxxx.pack" */ + char pack_name[FLEX_ARRAY]; /* more */ +}; + struct raw_object_store { /* * Path to the repository's object store. @@ -59,10 +83,15 @@ struct raw_object_store { */ char *objectdir; + struct packed_git *packed_git; + /* A most-recently-used ordered version of the packed_git list. */ + struct list_head packed_git_mru; + struct alternate_object_database *alt_odb_list; struct alternate_object_database **alt_odb_tail; }; -#define RAW_OBJECT_STORE_INIT { NULL, NULL, NULL } + +#define RAW_OBJECT_STORE_INIT(o) { NULL, NULL, LIST_HEAD_INIT(o.packed_git_mru), NULL, NULL } void raw_object_store_clear(struct raw_object_store *o); diff --git a/object.c b/object.c index 920dc4463fa..367441efa94 100644 --- a/object.c +++ b/object.c @@ -466,4 +466,10 @@ void raw_object_store_clear(struct raw_object_store *o) free_alt_odbs(o); o->alt_odb_tail = NULL; + + INIT_LIST_HEAD(&o->packed_git_mru); + /* + * TODO: call close_all_packs once migrated to + * take an object store argument + */ } diff --git a/pack-bitmap.c b/pack-bitmap.c index 9270983e5f5..bbede32589a 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -10,6 +10,7 @@ #include "pack-revindex.h" #include "pack-objects.h" #include "packfile.h" +#include "repository.h" /* * An entry on the bitmap index, representing the bitmap for a given @@ -335,7 +336,7 @@ static int open_pack_bitmap(void) assert(!bitmap_git.map && !bitmap_git.loaded); prepare_packed_git(); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (open_pack_bitmap_1(p) == 0) ret = 0; } diff --git a/packfile.c b/packfile.c index 216ea836ee3..59210deaaf7 100644 --- a/packfile.c +++ b/packfile.c @@ -45,8 +45,6 @@ static unsigned int pack_open_fds; static unsigned int pack_max_fds; static size_t peak_pack_mapped; static size_t pack_mapped; -struct packed_git *packed_git; -LIST_HEAD(packed_git_mru); #define SZ_FMT PRIuMAX static inline uintmax_t sz_fmt(size_t s) { return s; } @@ -246,7 +244,7 @@ static int unuse_one_window(struct packed_git *current) if (current) scan_windows(current, &lru_p, &lru_w, &lru_l); - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) scan_windows(p, &lru_p, &lru_w, &lru_l); if (lru_p) { munmap(lru_w->base, lru_w->len); @@ -316,7 +314,7 @@ void close_all_packs(void) { struct packed_git *p; - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) if (p->do_not_close) die("BUG: want to close pack marked 'do-not-close'"); else @@ -384,7 +382,7 @@ static int close_one_pack(void) struct pack_window *mru_w = NULL; int accept_windows_inuse = 1; - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (p->pack_fd == -1) continue; find_lru_pack(p, &lru_p, &mru_w, &accept_windows_inuse); @@ -686,8 +684,8 @@ void install_packed_git(struct packed_git *pack) if (pack->pack_fd != -1) pack_open_fds++; - pack->next = packed_git; - packed_git = pack; + pack->next = the_repository->objects.packed_git; + the_repository->objects.packed_git = pack; } void (*report_garbage)(unsigned seen_bits, const char *path); @@ -769,7 +767,8 @@ static void prepare_packed_git_one(char *objdir, int local) base_len = path.len; if (strip_suffix_mem(path.buf, &base_len, ".idx")) { /* Don't reopen a pack we already have. */ - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; + p = p->next) { size_t len; if (strip_suffix(p->pack_name, ".pack", &len) && len == base_len && @@ -820,7 +819,7 @@ unsigned long approximate_object_count(void) prepare_packed_git(); count = 0; - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if (open_pack_index(p)) continue; count += p->num_objects; @@ -869,18 +868,19 @@ static int sort_pack(const void *a_, const void *b_) static void rearrange_packed_git(void) { - packed_git = llist_mergesort(packed_git, get_next_packed_git, - set_next_packed_git, sort_pack); + the_repository->objects.packed_git = llist_mergesort( + the_repository->objects.packed_git, get_next_packed_git, + set_next_packed_git, sort_pack); } static void prepare_packed_git_mru(void) { struct packed_git *p; - INIT_LIST_HEAD(&packed_git_mru); + INIT_LIST_HEAD(&the_repository->objects.packed_git_mru); - for (p = packed_git; p; p = p->next) - list_add_tail(&p->mru, &packed_git_mru); + for (p = the_repository->objects.packed_git; p; p = p->next) + list_add_tail(&p->mru, &the_repository->objects.packed_git_mru); } static int prepare_packed_git_run_once = 0; @@ -1014,7 +1014,7 @@ const struct packed_git *has_packed_and_bad(const unsigned char *sha1) struct packed_git *p; unsigned i; - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) for (i = 0; i < p->num_bad_objects; i++) if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i)) return p; @@ -1845,13 +1845,14 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e) struct list_head *pos; prepare_packed_git(); - if (!packed_git) + if (!the_repository->objects.packed_git) return 0; - list_for_each(pos, &packed_git_mru) { + list_for_each(pos, &the_repository->objects.packed_git_mru) { struct packed_git *p = list_entry(pos, struct packed_git, mru); if (fill_pack_entry(sha1, e, p)) { - list_move(&p->mru, &packed_git_mru); + list_move(&p->mru, + &the_repository->objects.packed_git_mru); return 1; } } @@ -1898,7 +1899,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags) int pack_errors = 0; prepare_packed_git(); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local) continue; if ((flags & FOR_EACH_OBJECT_PROMISOR_ONLY) && diff --git a/repository.c b/repository.c index fb65e8072d5..a069b1b6404 100644 --- a/repository.c +++ b/repository.c @@ -7,7 +7,7 @@ /* The main repository */ static struct repository the_repo = { NULL, NULL, - RAW_OBJECT_STORE_INIT, + RAW_OBJECT_STORE_INIT(the_repo.objects), NULL, NULL, NULL, NULL, NULL, NULL, &the_index, @@ -143,6 +143,8 @@ int repo_init(struct repository *repo, const char *gitdir, const char *worktree) repo->ignore_env = 1; + INIT_LIST_HEAD(&repo->objects.packed_git_mru); + if (repo_init_gitdir(repo, gitdir)) goto error; diff --git a/server-info.c b/server-info.c index 26a6c20b7d4..c369ac27cbc 100644 --- a/server-info.c +++ b/server-info.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "repository.h" #include "refs.h" #include "object.h" #include "commit.h" @@ -200,7 +201,7 @@ static void init_pack_info(const char *infofile, int force) objdirlen = strlen(objdir); prepare_packed_git(); - for (p = packed_git; p; p = p->next) { + for (p = the_repository->objects.packed_git; p; p = p->next) { /* we ignore things on alternate path since they are * not available to the pullers in general. */ @@ -210,7 +211,7 @@ static void init_pack_info(const char *infofile, int force) } num_pack = i; info = xcalloc(num_pack, sizeof(struct pack_info *)); - for (i = 0, p = packed_git; p; p = p->next) { + for (i = 0, p = the_repository->objects.packed_git; p; p = p->next) { if (!p->pack_local) continue; info[i] = xcalloc(1, sizeof(struct pack_info)); diff --git a/sha1_name.c b/sha1_name.c index 957ce25680b..016c883b5c7 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -196,7 +196,8 @@ static void find_short_packed_object(struct disambiguate_state *ds) struct packed_git *p; prepare_packed_git(); - for (p = packed_git; p && !ds->ambiguous; p = p->next) + for (p = the_repository->objects.packed_git; p && !ds->ambiguous; + p = p->next) unique_in_pack(p, ds); } @@ -566,7 +567,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad) struct packed_git *p; prepare_packed_git(); - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) find_abbrev_len_for_pack(p, mad); } -- 2.16.1.291.g4437f3f132-goog