diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-09-18 21:50:09 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-09-18 21:50:09 +0300 |
commit | 627b82683447e299fc2e20140318c276efbf7de2 (patch) | |
tree | fd0da2b151024ebe5a71db00e75ec8a41eff9fd6 /builtin | |
parent | b9ac6c59b82dead613b31a51c8bca4dbd441bcbe (diff) | |
parent | 90d21f9ebf6906f0ebb4fb1b20ec9536072e2916 (diff) |
Merge branch 'md/list-objects-filter-combo'
The list-objects-filter API (used to create a sparse/lazy clone)
learned to take a combined filter specification.
* md/list-objects-filter-combo:
list-objects-filter-options: make parser void
list-objects-filter-options: clean up use of ALLOC_GROW
list-objects-filter-options: allow mult. --filter
strbuf: give URL-encoding API a char predicate fn
list-objects-filter-options: make filter_spec a string_list
list-objects-filter-options: move error check up
list-objects-filter: implement composite filters
list-objects-filter-options: always supply *errbuf
list-objects-filter: put omits set in filter struct
list-objects-filter: encapsulate filter components
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 8 | ||||
-rw-r--r-- | builtin/fetch.c | 9 | ||||
-rw-r--r-- | builtin/rev-list.c | 6 |
3 files changed, 10 insertions, 13 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index f665b28ccc..2048b6760a 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1160,13 +1160,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix) transport->server_options = &server_options; if (filter_options.choice) { - struct strbuf expanded_filter_spec = STRBUF_INIT; - expand_list_objects_filter_spec(&filter_options, - &expanded_filter_spec); + const char *spec = + expand_list_objects_filter_spec(&filter_options); transport_set_option(transport, TRANS_OPT_LIST_OBJECTS_FILTER, - expanded_filter_spec.buf); + spec); transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); - strbuf_release(&expanded_filter_spec); } if (transport->smart_options && !deepen && !filter_options.choice) diff --git a/builtin/fetch.c b/builtin/fetch.c index 538f0e7207..9b27ae9681 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1243,13 +1243,10 @@ static struct transport *prepare_transport(struct remote *remote, int deepen) if (update_shallow) set_option(transport, TRANS_OPT_UPDATE_SHALLOW, "yes"); if (filter_options.choice) { - struct strbuf expanded_filter_spec = STRBUF_INIT; - expand_list_objects_filter_spec(&filter_options, - &expanded_filter_spec); - set_option(transport, TRANS_OPT_LIST_OBJECTS_FILTER, - expanded_filter_spec.buf); + const char *spec = + expand_list_objects_filter_spec(&filter_options); + set_option(transport, TRANS_OPT_LIST_OBJECTS_FILTER, spec); set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); - strbuf_release(&expanded_filter_spec); } if (negotiation_tip.nr) { if (transport->smart_options) diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 301ccb970b..b8dc2e1fba 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -473,8 +473,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) die(_("object filtering requires --objects")); if (filter_options.choice == LOFC_SPARSE_OID && !filter_options.sparse_oid_value) - die(_("invalid sparse value '%s'"), - filter_options.filter_spec); + die( + _("invalid sparse value '%s'"), + list_objects_filter_spec( + &filter_options)); continue; } if (!strcmp(arg, ("--no-" CL_ARG__FILTER))) { |