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

Function store_bitmap

pack-bitmap.c:336–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
337 struct ewah_bitmap *root,
338 const struct object_id *oid,
339 struct stored_bitmap *xor_with,
340 int flags, size_t map_pos)
341{
342 struct stored_bitmap *stored;
343 khiter_t hash_pos;
344 int ret;
345
346 stored = xmalloc(sizeof(struct stored_bitmap));
347 stored->map_pos = map_pos;
348 stored->root = root;
349 stored->xor = xor_with;
350 stored->flags = flags;
351 oidcpy(&stored->oid, oid);
352
353 hash_pos = kh_put_oid_map(index->bitmaps, stored->oid, &ret);
354
355 /*
356 * A 0 return code means the insertion succeeded with no changes,
357 * because the SHA1 already existed on the map. This is bad, there
358 * shouldn't be duplicated commits in the index.
359 */
360 if (ret == 0) {
361 error(_("duplicate entry in bitmap index: '%s'"), oid_to_hex(oid));
362 return NULL;
363 }
364
365 kh_value(index->bitmaps, hash_pos) = stored;
366 return stored;
367}
368
369static inline uint32_t read_be32(const unsigned char *buffer, size_t *pos)
370{

Callers 2

load_bitmap_entries_v1Function · 0.85
lazy_bitmap_for_commitFunction · 0.85

Calls 4

oidcpyFunction · 0.85
errorFunction · 0.85
oid_to_hexFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected