* Step 1, split sender shallow commits into "ours" and "theirs" * Step 2, clean "ours" based on .git/shallow */
| 521 | * Step 2, clean "ours" based on .git/shallow |
| 522 | */ |
| 523 | void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa) |
| 524 | { |
| 525 | trace_printf_key(&trace_shallow, "shallow: prepare_shallow_info\n"); |
| 526 | memset(info, 0, sizeof(*info)); |
| 527 | commit_stack_init(&info->commits); |
| 528 | info->shallow = sa; |
| 529 | if (!sa) |
| 530 | return; |
| 531 | ALLOC_ARRAY(info->ours, sa->nr); |
| 532 | ALLOC_ARRAY(info->theirs, sa->nr); |
| 533 | for (size_t i = 0; i < sa->nr; i++) { |
| 534 | if (odb_has_object(the_repository->objects, sa->oid + i, |
| 535 | ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR)) { |
| 536 | struct commit_graft *graft; |
| 537 | graft = lookup_commit_graft(the_repository, |
| 538 | &sa->oid[i]); |
| 539 | if (graft && graft->nr_parent < 0) |
| 540 | continue; |
| 541 | info->ours[info->nr_ours++] = i; |
| 542 | } else |
| 543 | info->theirs[info->nr_theirs++] = i; |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | void clear_shallow_info(struct shallow_info *info) |
| 548 | { |
no test coverage detected