Merge branch 'jc/set-head-symref-fix'
"git fetch" from a configured remote learned to update a missing remote-tracking HEAD but it asked the remote about their HEAD even when it did not need to, which has been corrected. Incidentally, this also corrects "git fetch --tags $URL" which was broken by the new feature in an unspecified way. * jc/set-head-symref-fix: fetch: do not ask for HEAD unnecessarily
This commit is contained in:
@ -1640,6 +1640,21 @@ cleanup:
|
||||
return result;
|
||||
}
|
||||
|
||||
static int uses_remote_tracking(struct transport *transport, struct refspec *rs)
|
||||
{
|
||||
if (!remote_is_configured(transport->remote, 0))
|
||||
return 0;
|
||||
|
||||
if (!rs->nr)
|
||||
rs = &transport->remote->fetch;
|
||||
|
||||
for (int i = 0; i < rs->nr; i++)
|
||||
if (rs->items[i].dst)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_fetch(struct transport *transport,
|
||||
struct refspec *rs,
|
||||
const struct fetch_config *config)
|
||||
@ -1709,7 +1724,10 @@ static int do_fetch(struct transport *transport,
|
||||
"refs/tags/");
|
||||
}
|
||||
|
||||
strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
|
||||
if (uses_remote_tracking(transport, rs)) {
|
||||
must_list_refs = 1;
|
||||
strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
|
||||
}
|
||||
|
||||
if (must_list_refs) {
|
||||
trace2_region_enter("fetch", "remote_refs", the_repository);
|
||||
|
Reference in New Issue
Block a user