MCPcopy Create free account
hub / github.com/git/git / prepare_in_pack_by_idx

Function prepare_in_pack_by_idx

pack-objects.c:88–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88static void prepare_in_pack_by_idx(struct packing_data *pdata)
89{
90 struct packed_git **mapping, *p;
91 int cnt = 0, nr = 1U << OE_IN_PACK_BITS;
92
93 ALLOC_ARRAY(mapping, nr);
94 /*
95 * oe_in_pack() on an all-zero'd object_entry
96 * (i.e. in_pack_idx also zero) should return NULL.
97 */
98 mapping[cnt++] = NULL;
99 repo_for_each_pack(pdata->repo, p) {
100 if (cnt == nr) {
101 free(mapping);
102 return;
103 }
104 p->index = cnt;
105 mapping[cnt++] = p;
106 }
107 pdata->in_pack_by_idx = mapping;
108}
109
110/*
111 * A new pack appears after prepare_in_pack_by_idx() has been

Callers 1

prepare_packing_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected