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

Function wanted_peer_refs

builtin/clone.c:443–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443static struct ref *wanted_peer_refs(struct clone_opts *opts,
444 const struct ref *refs,
445 struct refspec *refspec)
446{
447 struct ref *local_refs = NULL;
448 struct ref **tail = &local_refs;
449 struct ref *to_free = NULL;
450
451 if (opts->wants_head) {
452 struct ref *head = copy_ref(find_ref_by_name(refs, "HEAD"));
453 if (head)
454 tail_link_ref(head, &tail);
455 if (option_single_branch)
456 refs = to_free =
457 guess_remote_head(head, refs,
458 REMOTE_GUESS_HEAD_QUIET);
459 } else if (option_single_branch) {
460 local_refs = NULL;
461 tail = &local_refs;
462 refs = to_free = copy_ref(find_remote_branch(refs, option_branch));
463 }
464
465 for (size_t i = 0; i < refspec->nr; i++)
466 get_fetch_map(refs, &refspec->items[i], &tail, 0);
467
468 free_one_ref(to_free);
469
470 return local_refs;
471}
472
473static void write_remote_refs(const struct ref *local_refs)
474{

Callers 1

cmd_cloneFunction · 0.85

Calls 7

copy_refFunction · 0.85
find_ref_by_nameFunction · 0.85
tail_link_refFunction · 0.85
guess_remote_headFunction · 0.85
find_remote_branchFunction · 0.85
get_fetch_mapFunction · 0.85
free_one_refFunction · 0.85

Tested by

no test coverage detected