#include "tree.h"
#include "object-store.h"
#include "midx.h"
+#include "promisor-remote.h"
char *odb_pack_name(struct strbuf *buf,
const unsigned char *sha1,
while (packed_git_limit < pack_mapped
&& unuse_one_window(p))
; /* nothing */
- win->base = xmmap(NULL, win->len,
+ win->base = xmmap_gently(NULL, win->len,
PROT_READ, MAP_PRIVATE,
p->pack_fd, win->offset);
if (win->base == MAP_FAILED)
}
rearrange_packed_git(r);
- r->objects->all_packs = NULL;
-
prepare_packed_git_mru(r);
r->objects->packed_git_initialized = 1;
}
struct packed_git *get_all_packs(struct repository *r)
{
- prepare_packed_git(r);
-
- if (!r->objects->all_packs) {
- struct packed_git *p = r->objects->packed_git;
- struct multi_pack_index *m;
-
- for (m = r->objects->multi_pack_index; m; m = m->next) {
- uint32_t i;
- for (i = 0; i < m->num_packs; i++) {
- if (!prepare_midx_pack(m, i)) {
- m->packs[i]->next = p;
- p = m->packs[i];
- }
- }
- }
+ struct multi_pack_index *m;
- r->objects->all_packs = p;
+ prepare_packed_git(r);
+ for (m = r->objects->multi_pack_index; m; m = m->next) {
+ uint32_t i;
+ for (i = 0; i < m->num_packs; i++)
+ prepare_midx_pack(r, m, i);
}
- return r->objects->all_packs;
+ return r->objects->packed_git;
}
struct list_head *get_packed_git_mru(struct repository *r)
return 0;
for (m = r->objects->multi_pack_index; m; m = m->next) {
- if (fill_midx_entry(oid, e, m))
+ if (fill_midx_entry(r, oid, e, m))
return 1;
}
list_for_each(pos, &r->objects->packed_git_mru) {
struct packed_git *p = list_entry(pos, struct packed_git, mru);
- if (fill_pack_entry(oid, e, p)) {
+ if (!p->multi_pack_index && fill_pack_entry(oid, e, p)) {
list_move(&p->mru, &r->objects->packed_git_mru);
return 1;
}
static int promisor_objects_prepared;
if (!promisor_objects_prepared) {
- if (repository_format_partial_clone) {
+ if (has_promisor_remote()) {
for_each_packed_object(add_promisor_object,
&promisor_objects,
FOR_EACH_OBJECT_PROMISOR_ONLY);