diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-29 14:02:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-07 13:53:59 -0800 |
commit | f2db854d24f32de7b03dde5a7d7134f5e31100b9 (patch) | |
tree | 3654e0cb8fcfc1b96fc66f5a1f199cd81a2e867d /transport.c | |
parent | def249911ad0e36a40a0603fc42b7e9cf0b21546 (diff) | |
download | git-f2db854d24f32de7b03dde5a7d7134f5e31100b9.tar.gz |
fetch: use struct ref to represent refs to be fetched
Even though "git fetch" has full infrastructure to parse refspecs to
be fetched and match them against the list of refs to come up with
the final list of refs to be fetched, the list of refs that are
requested to be fetched were internally converted to a plain list of
strings at the transport layer and then passed to the underlying
fetch-pack driver.
Stop this conversion and instead pass around an array of refs.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/transport.c b/transport.c index 2673d273ff..64ce6510f1 100644 --- a/transport.c +++ b/transport.c @@ -518,11 +518,9 @@ static int fetch_refs_via_pack(struct transport *transport, int nr_heads, struct ref **to_fetch) { struct git_transport_data *data = transport->data; - struct string_list sought = STRING_LIST_INIT_DUP; const struct ref *refs; char *dest = xstrdup(transport->url); struct fetch_pack_args args; - int i; struct ref *refs_tmp = NULL; memset(&args, 0, sizeof(args)); @@ -536,9 +534,6 @@ static int fetch_refs_via_pack(struct transport *transport, args.no_progress = !transport->progress; args.depth = data->options.depth; - for (i = 0; i < nr_heads; i++) - string_list_append(&sought, to_fetch[i]->name); - if (!data->got_remote_heads) { connect_setup(transport, 0, 0); get_remote_heads(data->fd[0], &refs_tmp, 0, NULL); @@ -547,7 +542,8 @@ static int fetch_refs_via_pack(struct transport *transport, refs = fetch_pack(&args, data->fd, data->conn, refs_tmp ? refs_tmp : transport->remote_refs, - dest, &sought, &transport->pack_lockfile); + dest, to_fetch, nr_heads, + &transport->pack_lockfile); close(data->fd[0]); close(data->fd[1]); if (finish_connect(data->conn)) @@ -557,7 +553,6 @@ static int fetch_refs_via_pack(struct transport *transport, free_refs(refs_tmp); - string_list_clear(&sought, 0); free(dest); return (refs ? 0 : -1); } |