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

Function find_object_pos

pack-bitmap-write.c:288–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288static uint32_t find_object_pos(struct bitmap_writer *writer,
289 const struct object_id *oid, int *found)
290{
291 struct object_entry *entry;
292 uint32_t pos;
293
294 bitmap_writer_init_pos_cache(writer);
295
296 if (find_cached_object_pos(writer, oid, &pos)) {
297 if (found)
298 *found = 1;
299 return pos;
300 }
301
302 entry = packlist_find(writer->to_pack, oid);
303 if (entry) {
304 uint32_t base_objects = 0;
305
306 if (writer->midx)
307 base_objects = writer->midx->num_objects +
308 writer->midx->num_objects_in_base;
309 pos = oe_in_pack_pos(writer->to_pack, entry) + base_objects;
310 } else if (writer->midx) {
311 uint32_t at;
312
313 if (!bsearch_midx(oid, writer->midx, &at))
314 goto missing;
315 if (midx_to_pack_pos(writer->midx, at, &pos) < 0)
316 goto missing;
317 } else {
318 goto missing;
319 }
320
321 if (found)
322 *found = 1;
323 return store_cached_object_pos(writer, oid, pos);
324
325missing:
326 if (found)
327 *found = 0;
328 warning("Failed to write bitmap index. Packfile doesn't have full closure "
329 "(object %s is missing)", oid_to_hex(oid));
330 return 0;
331}
332
333static int bitmapped_commit_date_cmp(const void *_a, const void *_b)
334{

Callers 5

fill_bitmap_treeFunction · 0.85
fill_bitmap_commitFunction · 0.85
write_pseudo_mergesFunction · 0.85

Calls 9

find_cached_object_posFunction · 0.85
packlist_findFunction · 0.85
oe_in_pack_posFunction · 0.85
bsearch_midxFunction · 0.85
midx_to_pack_posFunction · 0.85
store_cached_object_posFunction · 0.85
warningFunction · 0.85
oid_to_hexFunction · 0.85

Tested by

no test coverage detected