MCPcopy Create free account
hub / github.com/git/git / prepare_shallow_info

Function prepare_shallow_info

shallow.c:523–545  ·  view source on GitHub ↗

* Step 1, split sender shallow commits into "ours" and "theirs" * Step 2, clean "ours" based on .git/shallow */

Source from the content-addressed store, hash-verified

521 * Step 2, clean "ours" based on .git/shallow
522 */
523void 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
547void clear_shallow_info(struct shallow_info *info)
548{

Callers 3

receive_shallow_infoFunction · 0.85
fetch_packFunction · 0.85
cmd_receive_packFunction · 0.85

Calls 3

commit_stack_initFunction · 0.85
odb_has_objectFunction · 0.85
lookup_commit_graftFunction · 0.85

Tested by

no test coverage detected