object-store: move packed_git and packed_git_mru to object store
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. [nd: while at there, wrap access to these two fields in get_packed_git() and get_packed_git_mru(). This allows us to lazily initialize these fields without caller doing that explicitly] Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 23, 2018 at 18:20 UTC
a80d72db2a73174b3f22142eb2014b33696fd795
22 files changed
+128
-74
builtin/count-objects.c
+3
-2
@@ -7,6 +7,7 @@
7
#include "cache.h"
8
#include "config.h"
9
#include "dir.h"
10
+#include "repository.h"
11
#include "builtin.h"
12
#include "parse-options.h"
13
#include "quote.h"
@@ -121,9 +122,9 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
122
struct strbuf loose_buf = STRBUF_INIT;
123
struct strbuf pack_buf = STRBUF_INIT;
124
struct strbuf garbage_buf = STRBUF_INIT;
124
- if (!packed_git)
125
+ if (!get_packed_git(the_repository))
126
prepare_packed_git();
126
- for (p = packed_git; p; p = p->next) {
127
+ for (p = get_packed_git(the_repository); p; p = p->next) {
128
if (!p->pack_local)
129
continue;
130
if (open_pack_index(p))
builtin/fsck.c
+4
-2
@@ -732,7 +732,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
732
prepare_packed_git();
733
734
if (show_progress) {
735
- for (p = packed_git; p; p = p->next) {
735
+ for (p = get_packed_git(the_repository); p;
736
+ p = p->next) {
737
if (open_pack_index(p))
738
continue;
739
total += p->num_objects;
@@ -740,7 +741,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
741
742
progress = start_progress(_("Checking objects"), total);
743
}
743
- for (p = packed_git; p; p = p->next) {
744
+ for (p = get_packed_git(the_repository); p;
745
+ p = p->next) {
746
/* verify gives error messages itself */
747
if (verify_pack(p, fsck_obj_buffer,
748
progress, count))
builtin/gc.c
+3
-1
@@ -11,6 +11,7 @@
11
*/
12
13
#include "builtin.h"
14
+#include "repository.h"
15
#include "config.h"
16
#include "tempfile.h"
17
#include "lockfile.h"
@@ -20,6 +21,7 @@
21
#include "argv-array.h"
22
#include "commit.h"
23
#include "packfile.h"
24
+#include "object-store.h"
25
26
#define FAILED_RUN "failed to run %s"
27
@@ -173,7 +175,7 @@ static int too_many_packs(void)
175
return 0;
176
177
prepare_packed_git();
176
- for (cnt = 0, p = packed_git; p; p = p->next) {
178
+ for (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {
179
if (!p->pack_local)
180
continue;
181
if (p->pack_keep)
builtin/index-pack.c
+1
@@ -13,6 +13,7 @@
13
#include "streaming.h"
14
#include "thread-utils.h"
15
#include "packfile.h"
16
+#include "object-store.h"
17
18
static const char index_pack_usage[] =
19
"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
builtin/pack-objects.c
+12
-9
@@ -1,5 +1,6 @@
1
#include "builtin.h"
2
#include "cache.h"
3
+#include "repository.h"
4
#include "config.h"
5
#include "attr.h"
6
#include "object.h"
@@ -28,6 +29,7 @@
29
#include "argv-array.h"
30
#include "list.h"
31
#include "packfile.h"
32
+#include "object-store.h"
33
34
static const char *pack_usage[] = {
35
N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"),
@@ -1025,8 +1027,7 @@ static int want_object_in_pack(const struct object_id *oid,
1027
if (want != -1)
1028
return want;
1029
}
1028
-
1029
- list_for_each(pos, &packed_git_mru) {
1030
+ list_for_each(pos, get_packed_git_mru(the_repository)) {
1031
struct packed_git *p = list_entry(pos, struct packed_git, mru);
1032
off_t offset;
1033
@@ -1044,7 +1045,8 @@ static int want_object_in_pack(const struct object_id *oid,
1045
}
1046
want = want_found_object(exclude, p);
1047
if (!exclude && want > 0)
1047
- list_move(&p->mru, &packed_git_mru);
1048
+ list_move(&p->mru,
1049
+ get_packed_git_mru(the_repository));
1050
if (want != -1)
1051
return want;
1052
}
@@ -2673,7 +2675,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
2675
2676
memset(&in_pack, 0, sizeof(in_pack));
2677
2676
- for (p = packed_git; p; p = p->next) {
2678
+ for (p = get_packed_git(the_repository); p; p = p->next) {
2679
struct object_id oid;
2680
struct object *o;
2681
@@ -2736,7 +2738,8 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
2738
static struct packed_git *last_found = (void *)1;
2739
struct packed_git *p;
2740
2739
- p = (last_found != (void *)1) ? last_found : packed_git;
2741
+ p = (last_found != (void *)1) ? last_found :
2742
+ get_packed_git(the_repository);
2743
2744
while (p) {
2745
if ((!p->pack_local || p->pack_keep) &&
@@ -2745,7 +2748,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
2748
return 1;
2749
}
2750
if (p == last_found)
2748
- p = packed_git;
2751
+ p = get_packed_git(the_repository);
2752
else
2753
p = p->next;
2754
if (p == last_found)
@@ -2781,7 +2784,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
2784
uint32_t i;
2785
struct object_id oid;
2786
2784
- for (p = packed_git; p; p = p->next) {
2787
+ for (p = get_packed_git(the_repository); p; p = p->next) {
2788
if (!p->pack_local || p->pack_keep)
2789
continue;
2790
@@ -3152,7 +3155,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3155
prepare_packed_git();
3156
if (ignore_packed_keep) {
3157
struct packed_git *p;
3155
- for (p = packed_git; p; p = p->next)
3158
+ for (p = get_packed_git(the_repository); p; p = p->next)
3159
if (p->pack_local && p->pack_keep)
3160
break;
3161
if (!p) /* no keep-able packs found */
@@ -3165,7 +3168,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3168
* also covers non-local objects
3169
*/
3170
struct packed_git *p;
3168
- for (p = packed_git; p; p = p->next) {
3171
+ for (p = get_packed_git(the_repository); p; p = p->next) {
3172
if (!p->pack_local) {
3173
have_non_local_packs = 1;
3174
break;
builtin/pack-redundant.c
+4
-2
@@ -7,7 +7,9 @@
7
*/
8
9
#include "builtin.h"
10
+#include "repository.h"
11
#include "packfile.h"
12
+#include "object-store.h"
13
14
#define BLKSIZE 512
15
@@ -571,7 +573,7 @@ static struct pack_list * add_pack(struct packed_git *p)
573
574
static struct pack_list * add_pack_file(const char *filename)
575
{
574
- struct packed_git *p = packed_git;
576
+ struct packed_git *p = get_packed_git(the_repository);
577
578
if (strlen(filename) < 40)
579
die("Bad pack filename: %s", filename);
@@ -586,7 +588,7 @@ static struct pack_list * add_pack_file(const char *filename)
588
589
static void load_all(void)
590
{
589
- struct packed_git *p = packed_git;
591
+ struct packed_git *p = get_packed_git(the_repository);
592
593
while (p) {
594
add_pack(p);
cache.h
-29
@@ -1585,35 +1585,6 @@ struct pack_window {
1585
unsigned int inuse_cnt;
1586
};
1587
1588
-extern struct packed_git {
1589
- struct packed_git *next;
1590
- struct list_head mru;
1591
- struct pack_window *windows;
1592
- off_t pack_size;
1593
- const void *index_data;
1594
- size_t index_size;
1595
- uint32_t num_objects;
1596
- uint32_t num_bad_objects;
1597
- unsigned char *bad_object_sha1;
1598
- int index_version;
1599
- time_t mtime;
1600
- int pack_fd;
1601
- unsigned pack_local:1,
1602
- pack_keep:1,
1603
- freshened:1,
1604
- do_not_close:1,
1605
- pack_promisor:1;
1606
- unsigned char sha1[20];
1607
- struct revindex_entry *revindex;
1608
- /* something like ".git/objects/pack/xxxxx.pack" */
1609
- char pack_name[FLEX_ARRAY]; /* more */
1610
-} *packed_git;
1611
-
1612
-/*
1613
- * A most-recently-used ordered version of the packed_git list.
1614
- */
1615
-extern struct list_head packed_git_mru;
1616
-
1588
struct pack_entry {
1589
off_t offset;
1590
unsigned char sha1[20];
fast-import.c
+6
-2
@@ -154,6 +154,7 @@ Format of STDIN stream:
154
155
#include "builtin.h"
156
#include "cache.h"
157
+#include "repository.h"
158
#include "config.h"
159
#include "lockfile.h"
160
#include "object.h"
@@ -168,6 +169,7 @@ Format of STDIN stream:
169
#include "dir.h"
170
#include "run-command.h"
171
#include "packfile.h"
172
+#include "object-store.h"
173
174
#define PACK_ID_BITS 16
175
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -1110,7 +1112,8 @@ static int store_object(
1112
if (e->idx.offset) {
1113
duplicate_count_by_type[type]++;
1114
return 1;
1113
- } else if (find_sha1_pack(oid.hash, packed_git)) {
1115
+ } else if (find_sha1_pack(oid.hash,
1116
+ get_packed_git(the_repository))) {
1117
e->type = type;
1118
e->pack_id = MAX_PACK_ID;
1119
e->idx.offset = 1; /* just not zero! */
@@ -1305,7 +1308,8 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
1308
duplicate_count_by_type[OBJ_BLOB]++;
1309
truncate_pack(&checkpoint);
1310
1308
- } else if (find_sha1_pack(oid.hash, packed_git)) {
1311
+ } else if (find_sha1_pack(oid.hash,
1312
+ get_packed_git(the_repository))) {
1313
e->type = OBJ_BLOB;
1314
e->pack_id = MAX_PACK_ID;
1315
e->idx.offset = 1; /* just not zero! */
http-backend.c
+4
-2
@@ -1,5 +1,6 @@
1
#include "cache.h"
2
#include "config.h"
3
+#include "repository.h"
4
#include "refs.h"
5
#include "pkt-line.h"
6
#include "object.h"
@@ -10,6 +11,7 @@
11
#include "url.h"
12
#include "argv-array.h"
13
#include "packfile.h"
14
+#include "object-store.h"
15
16
static const char content_type[] = "Content-Type";
17
static const char content_length[] = "Content-Length";
@@ -518,13 +520,13 @@ static void get_info_packs(struct strbuf *hdr, char *arg)
520
521
select_getanyfile(hdr);
522
prepare_packed_git();
521
- for (p = packed_git; p; p = p->next) {
523
+ for (p = get_packed_git(the_repository); p; p = p->next) {
524
if (p->pack_local)
525
cnt++;
526
}
527
528
strbuf_grow(&buf, cnt * 53 + 2);
527
- for (p = packed_git; p; p = p->next) {
529
+ for (p = get_packed_git(the_repository); p; p = p->next) {
530
if (p->pack_local)
531
strbuf_addf(&buf, "P %s\n", p->pack_name + objdirlen + 6);
532
}
http-push.c
+1
@@ -12,6 +12,7 @@
12
#include "sigchain.h"
13
#include "argv-array.h"
14
#include "packfile.h"
15
+#include "object-store.h"
16
17
#ifdef EXPAT_NEEDS_XMLPARSE_H
18
#include <xmlparse.h>
http-walker.c
+1
@@ -5,6 +5,7 @@
5
#include "list.h"
6
#include "transport.h"
7
#include "packfile.h"
8
+#include "object-store.h"
9
10
struct alt_base {
11
char *base;
http.c
+1
@@ -14,6 +14,7 @@
14
#include "packfile.h"
15
#include "protocol.h"
16
#include "string-list.h"
17
+#include "object-store.h"
18
19
static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
20
static int trace_curl_data = 1;
object-store.h
+34
@@ -52,6 +52,30 @@ void add_to_alternates_memory(const char *dir);
52
*/
53
struct strbuf *alt_scratch_buf(struct alternate_object_database *alt);
54
55
+struct packed_git {
56
+ struct packed_git *next;
57
+ struct list_head mru;
58
+ struct pack_window *windows;
59
+ off_t pack_size;
60
+ const void *index_data;
61
+ size_t index_size;
62
+ uint32_t num_objects;
63
+ uint32_t num_bad_objects;
64
+ unsigned char *bad_object_sha1;
65
+ int index_version;
66
+ time_t mtime;
67
+ int pack_fd;
68
+ unsigned pack_local:1,
69
+ pack_keep:1,
70
+ freshened:1,
71
+ do_not_close:1,
72
+ pack_promisor:1;
73
+ unsigned char sha1[20];
74
+ struct revindex_entry *revindex;
75
+ /* something like ".git/objects/pack/xxxxx.pack" */
76
+ char pack_name[FLEX_ARRAY]; /* more */
77
+};
78
+
79
struct raw_object_store {
80
/*
81
* Path to the repository's object store.
@@ -64,6 +88,16 @@ struct raw_object_store {
88
89
struct alternate_object_database *alt_odb_list;
90
struct alternate_object_database **alt_odb_tail;
91
+
92
+ /*
93
+ * private data
94
+ *
95
+ * should only be accessed directly by packfile.c
96
+ */
97
+
98
+ struct packed_git *packed_git;
99
+ /* A most-recently-used ordered version of the packed_git list. */
100
+ struct list_head packed_git_mru;
101
};
102
103
struct raw_object_store *raw_object_store_new(void);
object.c
+7
@@ -452,6 +452,7 @@ struct raw_object_store *raw_object_store_new(void)
452
struct raw_object_store *o = xmalloc(sizeof(*o));
453
454
memset(o, 0, sizeof(*o));
455
+ INIT_LIST_HEAD(&o->packed_git_mru);
456
return o;
457
}
458
@@ -480,4 +481,10 @@ void raw_object_store_clear(struct raw_object_store *o)
481
482
free_alt_odbs(o);
483
o->alt_odb_tail = NULL;
484
+
485
+ INIT_LIST_HEAD(&o->packed_git_mru);
486
+ /*
487
+ * TODO: call close_all_packs once migrated to
488
+ * take an object store argument
489
+ */
490
}
pack-bitmap.c
+3
-1
@@ -10,6 +10,8 @@
10
#include "pack-revindex.h"
11
#include "pack-objects.h"
12
#include "packfile.h"
13
+#include "repository.h"
14
+#include "object-store.h"
15
16
/*
17
* An entry on the bitmap index, representing the bitmap for a given
@@ -335,7 +337,7 @@ static int open_pack_bitmap(void)
337
assert(!bitmap_git.map && !bitmap_git.loaded);
338
339
prepare_packed_git();
338
- for (p = packed_git; p; p = p->next) {
340
+ for (p = get_packed_git(the_repository); p; p = p->next) {
341
if (open_pack_bitmap_1(p) == 0)
342
ret = 0;
343
}
pack-check.c
+1
@@ -3,6 +3,7 @@
3
#include "pack-revindex.h"
4
#include "progress.h"
5
#include "packfile.h"
6
+#include "object-store.h"
7
8
struct idx_entry {
9
off_t offset;
pack-revindex.c
+1
@@ -1,5 +1,6 @@
1
#include "cache.h"
2
#include "pack-revindex.h"
3
+#include "object-store.h"
4
5
/*
6
* Pack index for existing packs give us easy access to the offsets into
packfile.c
+31
-20
@@ -46,8 +46,6 @@ static unsigned int pack_open_fds;
46
static unsigned int pack_max_fds;
47
static size_t peak_pack_mapped;
48
static size_t pack_mapped;
49
-struct packed_git *packed_git;
50
-LIST_HEAD(packed_git_mru);
49
50
#define SZ_FMT PRIuMAX
51
static inline uintmax_t sz_fmt(size_t s) { return s; }
@@ -247,7 +245,7 @@ static int unuse_one_window(struct packed_git *current)
245
246
if (current)
247
scan_windows(current, &lru_p, &lru_w, &lru_l);
250
- for (p = packed_git; p; p = p->next)
248
+ for (p = the_repository->objects->packed_git; p; p = p->next)
249
scan_windows(p, &lru_p, &lru_w, &lru_l);
250
if (lru_p) {
251
munmap(lru_w->base, lru_w->len);
@@ -317,7 +315,7 @@ void close_all_packs(void)
315
{
316
struct packed_git *p;
317
320
- for (p = packed_git; p; p = p->next)
318
+ for (p = the_repository->objects->packed_git; p; p = p->next)
319
if (p->do_not_close)
320
die("BUG: want to close pack marked 'do-not-close'");
321
else
@@ -385,7 +383,7 @@ static int close_one_pack(void)
383
struct pack_window *mru_w = NULL;
384
int accept_windows_inuse = 1;
385
388
- for (p = packed_git; p; p = p->next) {
386
+ for (p = the_repository->objects->packed_git; p; p = p->next) {
387
if (p->pack_fd == -1)
388
continue;
389
find_lru_pack(p, &lru_p, &mru_w, &accept_windows_inuse);
@@ -687,8 +685,8 @@ void install_packed_git(struct packed_git *pack)
685
if (pack->pack_fd != -1)
686
pack_open_fds++;
687
690
- pack->next = packed_git;
691
- packed_git = pack;
688
+ pack->next = the_repository->objects->packed_git;
689
+ the_repository->objects->packed_git = pack;
690
}
691
692
void (*report_garbage)(unsigned seen_bits, const char *path);
@@ -770,7 +768,8 @@ static void prepare_packed_git_one(char *objdir, int local)
768
base_len = path.len;
769
if (strip_suffix_mem(path.buf, &base_len, ".idx")) {
770
/* Don't reopen a pack we already have. */
773
- for (p = packed_git; p; p = p->next) {
771
+ for (p = the_repository->objects->packed_git; p;
772
+ p = p->next) {
773
size_t len;
774
if (strip_suffix(p->pack_name, ".pack", &len) &&
775
len == base_len &&
@@ -821,7 +820,7 @@ unsigned long approximate_object_count(void)
820
821
prepare_packed_git();
822
count = 0;
824
- for (p = packed_git; p; p = p->next) {
823
+ for (p = the_repository->objects->packed_git; p; p = p->next) {
824
if (open_pack_index(p))
825
continue;
826
count += p->num_objects;
@@ -870,18 +869,19 @@ static int sort_pack(const void *a_, const void *b_)
869
870
static void rearrange_packed_git(void)
871
{
873
- packed_git = llist_mergesort(packed_git, get_next_packed_git,
874
- set_next_packed_git, sort_pack);
872
+ the_repository->objects->packed_git = llist_mergesort(
873
+ the_repository->objects->packed_git, get_next_packed_git,
874
+ set_next_packed_git, sort_pack);
875
}
876
877
static void prepare_packed_git_mru(void)
878
{
879
struct packed_git *p;
880
881
- INIT_LIST_HEAD(&packed_git_mru);
881
+ INIT_LIST_HEAD(&the_repository->objects->packed_git_mru);
882
883
- for (p = packed_git; p; p = p->next)
884
- list_add_tail(&p->mru, &packed_git_mru);
883
+ for (p = the_repository->objects->packed_git; p; p = p->next)
884
+ list_add_tail(&p->mru, &the_repository->objects->packed_git_mru);
885
}
886
887
static int prepare_packed_git_run_once = 0;
@@ -907,6 +907,16 @@ void reprepare_packed_git(void)
907
prepare_packed_git();
908
}
909
910
+struct packed_git *get_packed_git(struct repository *r)
911
+{
912
+ return r->objects->packed_git;
913
+}
914
+
915
+struct list_head *get_packed_git_mru(struct repository *r)
916
+{
917
+ return &r->objects->packed_git_mru;
918
+}
919
+
920
unsigned long unpack_object_header_buffer(const unsigned char *buf,
921
unsigned long len, enum object_type *type, unsigned long *sizep)
922
{
@@ -1015,7 +1025,7 @@ const struct packed_git *has_packed_and_bad(const unsigned char *sha1)
1025
struct packed_git *p;
1026
unsigned i;
1027
1018
- for (p = packed_git; p; p = p->next)
1028
+ for (p = the_repository->objects->packed_git; p; p = p->next)
1029
for (i = 0; i < p->num_bad_objects; i++)
1030
if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i))
1031
return p;
@@ -1846,13 +1856,14 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
1856
struct list_head *pos;
1857
1858
prepare_packed_git();
1849
- if (!packed_git)
1859
+ if (!the_repository->objects->packed_git)
1860
return 0;
1861
1852
- list_for_each(pos, &packed_git_mru) {
1862
+ list_for_each(pos, &the_repository->objects->packed_git_mru) {
1863
struct packed_git *p = list_entry(pos, struct packed_git, mru);
1864
if (fill_pack_entry(sha1, e, p)) {
1855
- list_move(&p->mru, &packed_git_mru);
1865
+ list_move(&p->mru,
1866
+ &the_repository->objects->packed_git_mru);
1867
return 1;
1868
}
1869
}
@@ -1899,7 +1910,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
1910
int pack_errors = 0;
1911
1912
prepare_packed_git();
1902
- for (p = packed_git; p; p = p->next) {
1913
+ for (p = the_repository->objects->packed_git; p; p = p->next) {
1914
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
1915
continue;
1916
if ((flags & FOR_EACH_OBJECT_PROMISOR_ONLY) &&
@@ -1930,7 +1941,7 @@ static int add_promisor_object(const struct object_id *oid,
1941
1942
/*
1943
* If this is a tree, commit, or tag, the objects it refers
1933
- * to are also promisor objects. (Blobs refer to no objects.)
1944
+ * to are also promisor objects. (Blobs refer to no objects->)
1945
*/
1946
if (obj->type == OBJ_TREE) {
1947
struct tree *tree = (struct tree *)obj;
packfile.h
+3
@@ -38,6 +38,9 @@ extern void prepare_packed_git(void);
38
extern void reprepare_packed_git(void);
39
extern void install_packed_git(struct packed_git *pack);
40
41
+struct packed_git *get_packed_git(struct repository *r);
42
+struct list_head *get_packed_git_mru(struct repository *r);
43
+
44
/*
45
* Give a rough count of objects in the repository. This sacrifices accuracy
46
* for speed.
reachable.c
+1
@@ -11,6 +11,7 @@
11
#include "list-objects.h"
12
#include "packfile.h"
13
#include "worktree.h"
14
+#include "object-store.h"
15
16
struct connectivity_progress {
17
struct progress *progress;
server-info.c
+4
-2
@@ -1,9 +1,11 @@
1
#include "cache.h"
2
+#include "repository.h"
3
#include "refs.h"
4
#include "object.h"
5
#include "commit.h"
6
#include "tag.h"
7
#include "packfile.h"
8
+#include "object-store.h"
9
10
/*
11
* Create the file "path" by writing to a temporary file and renaming
@@ -200,7 +202,7 @@ static void init_pack_info(const char *infofile, int force)
202
objdirlen = strlen(objdir);
203
204
prepare_packed_git();
203
- for (p = packed_git; p; p = p->next) {
205
+ for (p = get_packed_git(the_repository); p; p = p->next) {
206
/* we ignore things on alternate path since they are
207
* not available to the pullers in general.
208
*/
@@ -210,7 +212,7 @@ static void init_pack_info(const char *infofile, int force)
212
}
213
num_pack = i;
214
info = xcalloc(num_pack, sizeof(struct pack_info *));
213
- for (i = 0, p = packed_git; p; p = p->next) {
215
+ for (i = 0, p = get_packed_git(the_repository); p; p = p->next) {
216
if (!p->pack_local)
217
continue;
218
info[i] = xcalloc(1, sizeof(struct pack_info));
sha1_name.c
+3
-2
@@ -197,7 +197,8 @@ static void find_short_packed_object(struct disambiguate_state *ds)
197
struct packed_git *p;
198
199
prepare_packed_git();
200
- for (p = packed_git; p && !ds->ambiguous; p = p->next)
200
+ for (p = get_packed_git(the_repository); p && !ds->ambiguous;
201
+ p = p->next)
202
unique_in_pack(p, ds);
203
}
204
@@ -567,7 +568,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)
568
struct packed_git *p;
569
570
prepare_packed_git();
570
- for (p = packed_git; p; p = p->next)
571
+ for (p = get_packed_git(the_repository); p; p = p->next)
572
find_abbrev_len_for_pack(p, mad);
573
}
574