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

Function pseudo_merge_bitmap_for_commit

pack-bitmap.c:1470–1505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1468}
1469
1470struct ewah_bitmap *pseudo_merge_bitmap_for_commit(struct bitmap_index *bitmap_git,
1471 struct commit *commit)
1472{
1473 struct commit_list *p;
1474 struct bitmap *parents;
1475 struct pseudo_merge *match = NULL;
1476
1477 if (!bitmap_git->pseudo_merges.nr)
1478 return NULL;
1479
1480 parents = bitmap_new();
1481
1482 for (p = commit->parents; p; p = p->next) {
1483 int pos = bitmap_position(bitmap_git, &p->item->object.oid);
1484 if (pos < 0 || pos >= bitmap_num_objects(bitmap_git))
1485 goto done;
1486
1487 /*
1488 * Use bitmap-relative positions instead of offsetting
1489 * by bitmap_git->num_objects_in_base because we use
1490 * this to find a match in pseudo_merge_for_parents(),
1491 * and pseudo-merge groups cannot span multiple bitmap
1492 * layers.
1493 */
1494 bitmap_set(parents, pos);
1495 }
1496
1497 match = pseudo_merge_for_parents(&bitmap_git->pseudo_merges, parents);
1498
1499done:
1500 bitmap_free(parents);
1501 if (match)
1502 return pseudo_merge_bitmap(&bitmap_git->pseudo_merges, match);
1503
1504 return NULL;
1505}
1506
1507static void unsatisfy_all_pseudo_merges(struct bitmap_index *bitmap_git)
1508{

Callers 1

Calls 7

bitmap_newFunction · 0.85
bitmap_positionFunction · 0.85
bitmap_num_objectsFunction · 0.85
bitmap_setFunction · 0.85
pseudo_merge_for_parentsFunction · 0.85
bitmap_freeFunction · 0.85
pseudo_merge_bitmapFunction · 0.85

Tested by

no test coverage detected