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

Function ext_index_add_object

pack-bitmap.c:1106–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1104}
1105
1106static int ext_index_add_object(struct bitmap_index *bitmap_git,
1107 struct object *object, const char *name)
1108{
1109 struct eindex *eindex = &bitmap_git->ext_index;
1110
1111 khiter_t hash_pos;
1112 int hash_ret;
1113 int bitmap_pos;
1114
1115 hash_pos = kh_put_oid_pos(eindex->positions, object->oid, &hash_ret);
1116 if (hash_ret > 0) {
1117 if (eindex->count >= eindex->alloc) {
1118 eindex->alloc = (eindex->alloc + 16) * 3 / 2;
1119 REALLOC_ARRAY(eindex->objects, eindex->alloc);
1120 REALLOC_ARRAY(eindex->hashes, eindex->alloc);
1121 }
1122
1123 bitmap_pos = eindex->count;
1124 eindex->objects[eindex->count] = object;
1125 eindex->hashes[eindex->count] = pack_name_hash(name);
1126 kh_value(eindex->positions, hash_pos) = bitmap_pos;
1127 eindex->count++;
1128 } else {
1129 bitmap_pos = kh_value(eindex->positions, hash_pos);
1130 }
1131
1132 return bitmap_pos + bitmap_num_objects_total(bitmap_git);
1133}
1134
1135struct bitmap_show_data {
1136 struct bitmap_index *bitmap_git;

Callers 2

show_objectFunction · 0.85
should_includeFunction · 0.85

Calls 2

pack_name_hashFunction · 0.85
bitmap_num_objects_totalFunction · 0.85

Tested by

no test coverage detected