diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2012-09-09 08:19:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-12 11:46:31 -0700 |
commit | 4ba159996f6c1b0d6dd0a2a8bd9d6f5b342a4aa5 (patch) | |
tree | f358d131bb86e019d442b92cc1ce683b93461b44 /transport.c | |
parent | 4c58f13ba67f9dbe67a351de61703a2db20712cc (diff) | |
download | git-4ba159996f6c1b0d6dd0a2a8bd9d6f5b342a4aa5.tar.gz |
filter_refs(): delete matched refs from sought list
Remove any references that are available from the remote from the
sought list (rather than overwriting their names with NUL characters,
as previously). Mark matching entries by writing a non-NULL pointer
to string_list_item::util during the iteration, then use
filter_string_list() later to filter out the entries that have been
marked.
Document this aspect of fetch_pack() in a comment in the header file.
(More documentation is obviously still needed.)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/transport.c b/transport.c index a847bf31e2..9932f402df 100644 --- a/transport.c +++ b/transport.c @@ -518,8 +518,7 @@ 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 orig_sought = STRING_LIST_INIT_DUP; - struct string_list sought = STRING_LIST_INIT_NODUP; + struct string_list sought = STRING_LIST_INIT_DUP; const struct ref *refs; char *dest = xstrdup(transport->url); struct fetch_pack_args args; @@ -537,10 +536,8 @@ 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(&orig_sought, to_fetch[i]->name); - string_list_append(&sought, orig_sought.items[orig_sought.nr - 1].string); - } + 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); @@ -561,7 +558,6 @@ static int fetch_refs_via_pack(struct transport *transport, free_refs(refs_tmp); string_list_clear(&sought, 0); - string_list_clear(&orig_sought, 0); free(dest); return (refs ? 0 : -1); } |