aboutsummaryrefslogtreecommitdiffstats
path: root/transport-helper.c
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2019-06-27 15:54:10 -0700
committerJunio C Hamano <gitster@pobox.com>2019-06-28 08:41:53 -0700
commitcf9ceb5a12cad9c9153d227a0f497d1b522ce085 (patch)
treec44af4360522bd6fb3e7683eae387b24cd90e5a8 /transport-helper.c
parentf56f764279be2433ecf3cb3a484210bcaffea70c (diff)
downloadgit-cf9ceb5a12cad9c9153d227a0f497d1b522ce085.tar.gz
list-objects-filter-options: make filter_spec a string_list
Make the filter_spec string a string_list rather than a raw C string. The list of strings must be concatted together to make a complete filter_spec. A future patch will use this capability to build "combine:" filter specs gradually. A strbuf would seem to be a more natural choice for this object, but it unfortunately requires initialization besides just zero'ing out the memory. This results in all container structs, and all containers of those structs, etc., to also require initialization. Initializing them all would be more cumbersome that simply using a string_list, which behaves properly when its contents are zero'd. For the purposes of code simplification, change behavior in how filter specs are conveyed over the protocol: do not normalize the tree:<depth> filter specs since there should be no server in existence that supports tree:# but not tree:#k etc. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/transport-helper.c b/transport-helper.c
index c7e17ec9cb..0a34544df0 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -682,13 +682,9 @@ static int fetch(struct transport *transport,
set_helper_option(transport, "update-shallow", "true");
if (data->transport_options.filter_options.choice) {
- struct strbuf expanded_filter_spec = STRBUF_INIT;
- expand_list_objects_filter_spec(
- &data->transport_options.filter_options,
- &expanded_filter_spec);
- set_helper_option(transport, "filter",
- expanded_filter_spec.buf);
- strbuf_release(&expanded_filter_spec);
+ const char *spec = expand_list_objects_filter_spec(
+ &data->transport_options.filter_options);
+ set_helper_option(transport, "filter", spec);
}
if (data->transport_options.negotiation_tips)