MCPcopy Index your code
hub / github.com/git/git / rehash_objects

Function rehash_objects

pack-objects.c:43–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static void rehash_objects(struct packing_data *pdata)
44{
45 uint32_t i;
46 struct object_entry *entry;
47
48 pdata->index_size = closest_pow2(pdata->nr_objects * 3);
49 if (pdata->index_size < 1024)
50 pdata->index_size = 1024;
51
52 free(pdata->index);
53 CALLOC_ARRAY(pdata->index, pdata->index_size);
54
55 entry = pdata->objects;
56
57 for (i = 0; i < pdata->nr_objects; i++) {
58 int found;
59 uint32_t ix = locate_object_entry_hash(pdata,
60 &entry->idx.oid,
61 &found);
62
63 if (found)
64 BUG("Duplicate object in hash");
65
66 pdata->index[ix] = i + 1;
67 entry++;
68 }
69}
70
71struct object_entry *packlist_find(struct packing_data *pdata,
72 const struct object_id *oid)

Callers 1

packlist_allocFunction · 0.85

Calls 2

closest_pow2Function · 0.85
locate_object_entry_hashFunction · 0.85

Tested by

no test coverage detected