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

Function update_remote_refs

builtin/clone.c:534–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534static void update_remote_refs(const struct ref *refs,
535 const struct ref *mapped_refs,
536 const struct ref *remote_head_points_at,
537 const char *branch_top,
538 const char *msg,
539 struct transport *transport,
540 int check_connectivity)
541{
542 const struct ref *rm = mapped_refs;
543
544 if (check_connectivity) {
545 struct check_connected_options opt = CHECK_CONNECTED_INIT;
546
547 opt.transport = transport;
548 opt.progress = transport->progress;
549
550 if (check_connected(iterate_ref_map, &rm, &opt))
551 die(_("remote did not send all necessary objects"));
552 }
553
554 if (refs) {
555 write_remote_refs(mapped_refs);
556 if (option_single_branch && option_tags)
557 write_followtags(refs, msg);
558 }
559
560 if (remote_head_points_at && !option_bare) {
561 struct strbuf head_ref = STRBUF_INIT;
562 strbuf_addstr(&head_ref, branch_top);
563 strbuf_addstr(&head_ref, "HEAD");
564 if (refs_update_symref(get_main_ref_store(the_repository), head_ref.buf,
565 remote_head_points_at->peer_ref->name,
566 msg) < 0)
567 die(_("unable to update %s"), head_ref.buf);
568 strbuf_release(&head_ref);
569 }
570}
571
572static void update_head(struct clone_opts *opts, const struct ref *our, const struct ref *remote,
573 const char *unborn, const char *msg)

Callers 1

cmd_cloneFunction · 0.85

Calls 8

check_connectedFunction · 0.85
write_remote_refsFunction · 0.85
write_followtagsFunction · 0.85
strbuf_addstrFunction · 0.85
refs_update_symrefFunction · 0.85
get_main_ref_storeFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected