diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-08-07 15:14:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-07 16:24:30 -0700 |
commit | 069d50320257b76504921a7bc77696a6d858bfec (patch) | |
tree | 46bf080a2ee9c22995e424672961ec5b747eba16 /builtin/fetch.c | |
parent | db5723c6283d9a8dff3397c432af80cf5e2f7766 (diff) | |
download | git-069d50320257b76504921a7bc77696a6d858bfec.tar.gz |
fetch: refactor code that fetches leftover tags
Usually the upload-pack process running on the other side will give
us all the reachable tags we need during the primary object transfer
in do_fetch(). If that does not happen (e.g. the other side may be
running a third-party implementation of upload-pack), we will run
another fetch to pick up leftover tags that we know point at the
commits reachable from our updated tips.
Separate out the code to run this second fetch into a helper
function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r-- | builtin/fetch.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 39a3fc8dea..0b21f071b3 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -745,6 +745,13 @@ struct transport *prepare_transport(struct remote *remote) return transport; } +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"); + fetch_refs(transport, ref_map); +} + static int do_fetch(struct transport *transport, struct refspec *refs, int ref_count) { @@ -828,11 +835,8 @@ static int do_fetch(struct transport *transport, struct ref **tail = &ref_map; ref_map = NULL; find_non_local_tags(transport, &ref_map, &tail); - if (ref_map) { - transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, NULL); - transport_set_option(transport, TRANS_OPT_DEPTH, "0"); - fetch_refs(transport, ref_map); - } + if (ref_map) + backfill_tags(transport, ref_map); free_refs(ref_map); } |