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

Function find_objects

pack-bitmap.c:1514–1638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512}
1513
1514static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
1515 struct rev_info *revs,
1516 struct object_list *roots,
1517 struct bitmap *seen)
1518{
1519 struct bitmap *base = NULL;
1520 int needs_walk = 0;
1521 unsigned existing_bitmaps = 0;
1522
1523 struct object_list *not_mapped = NULL;
1524
1525 unsatisfy_all_pseudo_merges(bitmap_git);
1526
1527 if (bitmap_git->pseudo_merges.nr) {
1528 struct bitmap *roots_bitmap = bitmap_new();
1529 struct object_list *objects = NULL;
1530
1531 for (objects = roots; objects; objects = objects->next) {
1532 struct object *object = objects->item;
1533 int pos;
1534
1535 pos = bitmap_position(bitmap_git, &object->oid);
1536 if (pos < 0)
1537 continue;
1538
1539 bitmap_set(roots_bitmap, pos);
1540 }
1541
1542 base = bitmap_new();
1543 cascade_pseudo_merges_1(bitmap_git, base, roots_bitmap);
1544 bitmap_free(roots_bitmap);
1545 }
1546
1547 /*
1548 * Go through all the roots for the walk. The ones that have bitmaps
1549 * on the bitmap index will be `or`ed together to form an initial
1550 * global reachability analysis.
1551 *
1552 * The ones without bitmaps in the index will be stored in the
1553 * `not_mapped_list` for further processing.
1554 */
1555 while (roots) {
1556 struct object *object = roots->item;
1557
1558 roots = roots->next;
1559
1560 if (base) {
1561 int pos = bitmap_position(bitmap_git, &object->oid);
1562 if (pos > 0 && bitmap_get(base, pos)) {
1563 object->flags |= SEEN;
1564 continue;
1565 }
1566 }
1567
1568 if (object->type == OBJ_COMMIT &&
1569 add_commit_to_bitmap(bitmap_git, &base, (struct commit *)object)) {
1570 object->flags |= SEEN;
1571 existing_bitmaps = 1;

Callers 1

prepare_bitmap_walkFunction · 0.85

Calls 12

bitmap_newFunction · 0.85
bitmap_positionFunction · 0.85
bitmap_setFunction · 0.85
cascade_pseudo_merges_1Function · 0.85
bitmap_freeFunction · 0.85
bitmap_getFunction · 0.85
add_commit_to_bitmapFunction · 0.85
object_list_insertFunction · 0.85
add_pending_objectFunction · 0.85
fill_in_bitmapFunction · 0.85
object_list_freeFunction · 0.85

Tested by

no test coverage detected