diff options
-rw-r--r-- | midx.c | 11 | ||||
-rw-r--r-- | midx.h | 6 | ||||
-rw-r--r-- | packfile.c | 4 | ||||
-rw-r--r-- | t/helper/test-read-midx.c | 2 |
4 files changed, 13 insertions, 10 deletions
@@ -37,7 +37,7 @@ static char *get_midx_filename(const char *object_dir) return xstrfmt("%s/pack/multi-pack-index", object_dir); } -struct multi_pack_index *load_multi_pack_index(const char *object_dir) +struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local) { struct multi_pack_index *m = NULL; int fd; @@ -73,6 +73,7 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir) m->fd = fd; m->data = midx_map; m->data_len = midx_size; + m->local = local; m->signature = get_be32(m->data); if (m->signature != MIDX_SIGNATURE) { @@ -209,7 +210,7 @@ static int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id) strbuf_addf(&pack_name, "%s/pack/%s", m->object_dir, m->pack_names[pack_int_id]); - m->packs[pack_int_id] = add_packed_git(pack_name.buf, pack_name.len, 1); + m->packs[pack_int_id] = add_packed_git(pack_name.buf, pack_name.len, m->local); strbuf_release(&pack_name); return !m->packs[pack_int_id]; } @@ -318,7 +319,7 @@ int midx_contains_pack(struct multi_pack_index *m, const char *idx_name) return 0; } -int prepare_multi_pack_index_one(struct repository *r, const char *object_dir) +int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local) { struct multi_pack_index *m = r->objects->multi_pack_index; struct multi_pack_index *m_search; @@ -332,7 +333,7 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir) if (!strcmp(object_dir, m_search->object_dir)) return 1; - r->objects->multi_pack_index = load_multi_pack_index(object_dir); + r->objects->multi_pack_index = load_multi_pack_index(object_dir, local); if (r->objects->multi_pack_index) { r->objects->multi_pack_index->next = m; @@ -746,7 +747,7 @@ int write_midx_file(const char *object_dir) midx_name); } - packs.m = load_multi_pack_index(object_dir); + packs.m = load_multi_pack_index(object_dir, 1); packs.nr = 0; packs.alloc_list = packs.m ? packs.m->num_packs : 16; @@ -18,6 +18,8 @@ struct multi_pack_index { uint32_t num_packs; uint32_t num_objects; + int local; + const unsigned char *chunk_pack_names; const uint32_t *chunk_oid_fanout; const unsigned char *chunk_oid_lookup; @@ -29,14 +31,14 @@ struct multi_pack_index { char object_dir[FLEX_ARRAY]; }; -struct multi_pack_index *load_multi_pack_index(const char *object_dir); +struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local); int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result); struct object_id *nth_midxed_object_oid(struct object_id *oid, struct multi_pack_index *m, uint32_t n); int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m); int midx_contains_pack(struct multi_pack_index *m, const char *idx_name); -int prepare_multi_pack_index_one(struct repository *r, const char *object_dir); +int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local); int write_midx_file(const char *object_dir); void clear_midx_file(const char *object_dir); diff --git a/packfile.c b/packfile.c index 12db1a9d7d..896da460ac 100644 --- a/packfile.c +++ b/packfile.c @@ -963,11 +963,11 @@ static void prepare_packed_git(struct repository *r) if (r->objects->packed_git_initialized) return; - prepare_multi_pack_index_one(r, r->objects->objectdir); + prepare_multi_pack_index_one(r, r->objects->objectdir, 1); prepare_packed_git_one(r, r->objects->objectdir, 1); prepare_alt_odb(r); for (alt = r->objects->alt_odb_list; alt; alt = alt->next) { - prepare_multi_pack_index_one(r, alt->path); + prepare_multi_pack_index_one(r, alt->path, 0); prepare_packed_git_one(r, alt->path, 0); } rearrange_packed_git(r); diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c index 8e19972e89..831b586d02 100644 --- a/t/helper/test-read-midx.c +++ b/t/helper/test-read-midx.c @@ -7,7 +7,7 @@ static int read_midx_file(const char *object_dir) { uint32_t i; - struct multi_pack_index *m = load_multi_pack_index(object_dir); + struct multi_pack_index *m = load_multi_pack_index(object_dir, 1); if (!m) return 1; |