summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorLibravatar Matthew DeVore <matvore@google.com>2019-06-27 15:54:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-28 08:41:53 -0700
commit489fc9ee718b7c8594f17b55f090ac5292c655e1 (patch)
tree07a52471c29dea788f32700918402182c98f7c6c /upload-pack.c
parentstrbuf: give URL-encoding API a char predicate fn (diff)
downloadtgif-489fc9ee718b7c8594f17b55f090ac5292c655e1.tar.xz
list-objects-filter-options: allow mult. --filter
Allow combining of multiple filters by simply repeating the --filter flag. Before this patch, the user had to combine them in a single flag somewhat awkwardly (e.g. --filter=combine:FOO+BAR), including URL-encoding the individual filters. To make this work, in the --filter flag parsing callback, rather than error out when we detect that the filter_options struct is already populated, we modify it in-place to contain the added sub-filter. The existing sub-filter becomes the lhs of the combined filter, and the next sub-filter becomes the rhs. We also have to URL-encode the LHS and RHS sub-filters. We can simplify the operation if the LHS is already a combine: filter. In that case, we just append the URL-encoded RHS sub-filter to the LHS spec to get the new spec. Helped-by: Emily Shaffer <emilyshaffer@google.com> Helped-by: Jeff Hostetler <git@jeffhostetler.com> Helped-by: Jeff King <peff@peff.net> 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 'upload-pack.c')
-rw-r--r--upload-pack.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/upload-pack.c b/upload-pack.c
index d404d88941..f8a76ebda3 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -883,6 +883,7 @@ static void receive_needs(struct packet_reader *reader, struct object_array *wan
if (skip_prefix(reader->line, "filter ", &arg)) {
if (!filter_capability_requested)
die("git upload-pack: filtering capability not negotiated");
+ list_objects_filter_die_if_populated(&filter_options);
parse_list_objects_filter(&filter_options, arg);
continue;
}
@@ -1304,6 +1305,7 @@ static void process_args(struct packet_reader *request,
}
if (allow_filter && skip_prefix(arg, "filter ", &p)) {
+ list_objects_filter_die_if_populated(&filter_options);
parse_list_objects_filter(&filter_options, p);
continue;
}