| 441 | } |
| 442 | |
| 443 | static 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 | |
| 473 | static void write_remote_refs(const struct ref *local_refs) |
| 474 | { |
no test coverage detected