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

Function fetch_refs

transport-helper.c:717–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715 int for_push);
716
717static int fetch_refs(struct transport *transport,
718 int nr_heads, struct ref **to_fetch)
719{
720 struct helper_data *data = transport->data;
721 int i, count;
722
723 get_helper(transport);
724
725 if (process_connect(transport, 0))
726 return transport->vtable->fetch_refs(transport, nr_heads, to_fetch);
727
728 /*
729 * If we reach here, then the server, the client, and/or the transport
730 * helper does not support protocol v2. --negotiate-only requires
731 * protocol v2.
732 */
733 if (data->transport_options.acked_commits) {
734 warning(_("--negotiate-only requires protocol v2"));
735 return -1;
736 }
737
738 if (!data->get_refs_list_called) {
739 /*
740 * We do not care about the list of refs returned, but only
741 * that the "list" command was sent.
742 */
743 struct ref *dummy = get_refs_list_using_list(transport, 0);
744 free_refs(dummy);
745 }
746
747 count = 0;
748 for (i = 0; i < nr_heads; i++)
749 if (!(to_fetch[i]->status & REF_STATUS_UPTODATE))
750 count++;
751
752 if (!count)
753 return 0;
754
755 if (data->check_connectivity &&
756 data->transport_options.check_self_contained_and_connected)
757 set_helper_option(transport, "check-connectivity", "true");
758
759 if (transport->cloning)
760 set_helper_option(transport, "cloning", "true");
761
762 if (data->transport_options.update_shallow)
763 set_helper_option(transport, "update-shallow", "true");
764
765 if (data->transport_options.refetch)
766 set_helper_option(transport, "refetch", "true");
767
768 if (data->transport_options.filter_options.choice) {
769 const char *spec = expand_list_objects_filter_spec(
770 &data->transport_options.filter_options);
771 set_helper_option(transport, "filter", spec);
772 }
773
774 if (data->transport_options.negotiation_restrict_tips)

Callers

nothing calls this directly

Calls 9

get_helperFunction · 0.85
process_connectFunction · 0.85
warningFunction · 0.85
get_refs_list_using_listFunction · 0.85
free_refsFunction · 0.85
set_helper_optionFunction · 0.85
fetch_with_fetchFunction · 0.85
fetch_with_importFunction · 0.85

Tested by

no test coverage detected