git ls-remote :
int cmd_ls_remote(int argc, const char **argv, const char *prefix)
{
...
transport = transport_get(remote, NULL);
if (uploadpack != NULL)
transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
ref = transport_get_remote_refs(transport);
if (transport_disconnect(transport))
return 1;
if (!dest && !quiet)
fprintf(stderr, "From %s\n", *remote->url);
for ( ; ref; ref = ref->next) {
if (!check_ref_type(ref, flags))
continue;
if (!tail_match(pattern, ref->name))
continue;
if (show_symref_target && ref->symref)
printf("ref: %s\t%s\n", ref->symref, ref->name);
printf("%s\t%s\n", oid_to_hex(&ref->old_oid), ref->name);
status = 0;
}
return status;
}
UPDATE
, git , , refs/heads/branchname (, curl).
, HTTP, , . "", Git - ; HTTP GET, git .
...
, , , , , git, , git ls-remote ( , transport_get_remote_refs()). , , , .
-
...
, git send-pack receive-pack. send-pack receive-pack .
...
git-receive-pack .
...
fetch-pack upload-pack. fetch-pack, upload-pack .
...
fetch-pack , upload-pack - this:... , receive-pack, (.. refs + some ).
...