From: Junio C Hamano Date: Wed, 15 Aug 2018 22:08:25 +0000 (-0700) Subject: Merge branch 'jt/tag-following-with-proto-v2-fix' X-Git-Tag: v2.19.0-rc0~70 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d6628c99faf0de4d34c44f815d2aaa7dee38a300 Merge branch 'jt/tag-following-with-proto-v2-fix' The wire-protocol v2 relies on the client to send "ref prefixes" to limit the bandwidth spent on the initial ref advertisement. "git fetch $remote branch:branch" that asks tags that point into the history leading to the "branch" automatically followed sent to narrow prefix and broke the tag following, which has been fixed. * jt/tag-following-with-proto-v2-fix: fetch: send "refs/tags/" prefix upon CLI refspecs t5702: test fetch with multiple refspecs at a time --- d6628c99faf0de4d34c44f815d2aaa7dee38a300 diff --cc builtin/fetch.c index 34d2bd123b,1f447f1e8c..e03a1db1a3 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -1186,24 -1132,22 +1186,24 @@@ static int do_fetch(struct transport *t goto cleanup; } - ref_map = get_ref_map(transport, rs, tags, &autotags); - if (!update_head_ok) - check_not_current_branch(ref_map); + if (rs->nr) + refspec_ref_prefixes(rs, &ref_prefixes); + else if (transport->remote && transport->remote->fetch.nr) + refspec_ref_prefixes(&transport->remote->fetch, &ref_prefixes); - for (rm = ref_map; rm; rm = rm->next) { - if (rm->peer_ref) { - struct string_list_item *peer_item = - string_list_lookup(&existing_refs, - rm->peer_ref->name); - if (peer_item) { - struct object_id *old_oid = peer_item->util; - oidcpy(&rm->peer_ref->old_oid, old_oid); - } - } + if (ref_prefixes.argc && - (tags == TAGS_SET || (tags == TAGS_DEFAULT && !rs->nr))) { ++ (tags == TAGS_SET || (tags == TAGS_DEFAULT))) { + argv_array_push(&ref_prefixes, "refs/tags/"); } + remote_refs = transport_get_remote_refs(transport, &ref_prefixes); + argv_array_clear(&ref_prefixes); + + ref_map = get_ref_map(transport->remote, remote_refs, rs, + tags, &autotags); + if (!update_head_ok) + check_not_current_branch(ref_map); + if (tags == TAGS_DEFAULT && autotags) transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1"); if (prune) {