| 1468 | } |
| 1469 | |
| 1470 | struct 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 | |
| 1499 | done: |
| 1500 | bitmap_free(parents); |
| 1501 | if (match) |
| 1502 | return pseudo_merge_bitmap(&bitmap_git->pseudo_merges, match); |
| 1503 | |
| 1504 | return NULL; |
| 1505 | } |
| 1506 | |
| 1507 | static void unsatisfy_all_pseudo_merges(struct bitmap_index *bitmap_git) |
| 1508 | { |
no test coverage detected