diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2017-12-05 19:50:13 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-05 20:44:36 +0300 |
commit | 4875c9791e787af07992d3ba30061885322b7d11 (patch) | |
tree | 0f8136c4e7c50d7120dc9548af8d5fa755777735 /list-objects-filter-options.c | |
parent | 1dde5fa2b254663b3944053c67e45a1903682a80 (diff) |
list-objects-filter-options: support --no-filter
Teach opt_parse_list_objects_filter() to take --no-filter
option and to free the contents of struct filter_options.
This command line argument will be automatically inherited
by commands using OPT_PARSE_LIST_OBJECTS_FILTER(); this
includes pack-objects.
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects-filter-options.c')
-rw-r--r-- | list-objects-filter-options.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index 52bdec75bf..4c5b34e949 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -74,8 +74,19 @@ int opt_parse_list_objects_filter(const struct option *opt, { struct list_objects_filter_options *filter_options = opt->value; - assert(arg); - assert(!unset); + if (unset || !arg) { + list_objects_filter_release(filter_options); + return 0; + } return parse_list_objects_filter(filter_options, arg); } + +void list_objects_filter_release( + struct list_objects_filter_options *filter_options) +{ + free(filter_options->filter_spec); + free(filter_options->sparse_oid_value); + free(filter_options->sparse_path_value); + memset(filter_options, 0, sizeof(*filter_options)); +} |