diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-15 15:08:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-15 15:08:28 -0700 |
commit | b160b6e69d5e8231cf71b3bcacef63443849d1f9 (patch) | |
tree | a9d7d4cd00f10d1b4545b3fa3596bcd24f7c907c /builtin | |
parent | Merge branch 'sg/travis-retrieve-trash-upon-failure' (diff) | |
parent | fetch-pack: unify ref in and out param (diff) | |
download | tgif-b160b6e69d5e8231cf71b3bcacef63443849d1f9.tar.xz |
Merge branch 'jt/connectivity-check-after-unshallow'
"git fetch" sometimes failed to update the remote-tracking refs,
which has been corrected.
* jt/connectivity-check-after-unshallow:
fetch-pack: unify ref in and out param
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 4 | ||||
-rw-r--r-- | builtin/fetch.c | 28 |
2 files changed, 6 insertions, 26 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 26fb0da42d..fd2c3ef090 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1166,7 +1166,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) } if (!is_local && !complete_refs_before_fetch) - transport_fetch_refs(transport, mapped_refs, NULL); + transport_fetch_refs(transport, mapped_refs); remote_head = find_ref_by_name(refs, "HEAD"); remote_head_points_at = @@ -1208,7 +1208,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) if (is_local) clone_local(path, git_dir); else if (refs && complete_refs_before_fetch) - transport_fetch_refs(transport, mapped_refs, NULL); + transport_fetch_refs(transport, mapped_refs); update_remote_refs(refs, mapped_refs, remote_head_points_at, branch_top.buf, reflog_msg.buf, transport, diff --git a/builtin/fetch.c b/builtin/fetch.c index e03a1db1a3..61bec5d213 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -942,13 +942,11 @@ static int quickfetch(struct ref *ref_map) return check_connected(iterate_ref_map, &rm, &opt); } -static int fetch_refs(struct transport *transport, struct ref *ref_map, - struct ref **updated_remote_refs) +static int fetch_refs(struct transport *transport, struct ref *ref_map) { int ret = quickfetch(ref_map); if (ret) - ret = transport_fetch_refs(transport, ref_map, - updated_remote_refs); + ret = transport_fetch_refs(transport, ref_map); if (!ret) /* * Keep the new pack's ".keep" file around to allow the caller @@ -1153,7 +1151,7 @@ static void backfill_tags(struct transport *transport, struct ref *ref_map) transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, NULL); transport_set_option(transport, TRANS_OPT_DEPTH, "0"); transport_set_option(transport, TRANS_OPT_DEEPEN_RELATIVE, NULL); - if (!fetch_refs(transport, ref_map, NULL)) + if (!fetch_refs(transport, ref_map)) consume_refs(transport, ref_map); if (gsecondary) { @@ -1169,7 +1167,6 @@ static int do_fetch(struct transport *transport, int autotags = (transport->remote->fetch_tags == 1); int retcode = 0; const struct ref *remote_refs; - struct ref *updated_remote_refs = NULL; struct argv_array ref_prefixes = ARGV_ARRAY_INIT; if (tags == TAGS_DEFAULT) { @@ -1220,24 +1217,7 @@ static int do_fetch(struct transport *transport, transport->url); } } - - if (fetch_refs(transport, ref_map, &updated_remote_refs)) { - free_refs(ref_map); - retcode = 1; - goto cleanup; - } - if (updated_remote_refs) { - /* - * Regenerate ref_map using the updated remote refs. This is - * to account for additional information which may be provided - * by the transport (e.g. shallow info). - */ - free_refs(ref_map); - ref_map = get_ref_map(transport->remote, updated_remote_refs, rs, - tags, &autotags); - free_refs(updated_remote_refs); - } - if (consume_refs(transport, ref_map)) { + if (fetch_refs(transport, ref_map) || consume_refs(transport, ref_map)) { free_refs(ref_map); retcode = 1; goto cleanup; |