Skip to content

Commit

Permalink
fetch: refactor code that fetches leftover tags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Aug 7, 2013
1 parent db5723c commit 069d503
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 069d503

Please sign in to comment.