diff options
| author | Junio C Hamano <gitster@pobox.com> | 2019-09-18 11:50:09 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-09-18 11:50:09 -0700 |
| commit | 627b82683447e299fc2e20140318c276efbf7de2 (patch) | |
| tree | fd0da2b151024ebe5a71db00e75ec8a41eff9fd6 /list-objects-filter.h | |
| parent | b9ac6c59b82dead613b31a51c8bca4dbd441bcbe (diff) | |
| parent | 90d21f9ebf6906f0ebb4fb1b20ec9536072e2916 (diff) | |
| download | git-627b82683447e299fc2e20140318c276efbf7de2.tar.xz | |
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 'list-objects-filter.h')
| -rw-r--r-- | list-objects-filter.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/list-objects-filter.h b/list-objects-filter.h index 1d45a4ad57..cfd784e203 100644 --- a/list-objects-filter.h +++ b/list-objects-filter.h @@ -60,30 +60,36 @@ enum list_objects_filter_situation { LOFS_BLOB }; -typedef enum list_objects_filter_result (*filter_object_fn)( +struct filter; + +/* + * Constructor for the set of defined list-objects filters. + * The `omitted` set is optional. It is populated with objects that the + * filter excludes. This set should not be considered finalized until + * after list_objects_filter__free is called on the returned `struct + * filter *`. + */ +struct filter *list_objects_filter__init( + struct oidset *omitted, + struct list_objects_filter_options *filter_options); + +/* + * Lets `filter` decide how to handle the `obj`. If `filter` is NULL, this + * function behaves as expected if no filter is configured: all objects are + * included. + */ +enum list_objects_filter_result list_objects_filter__filter_object( struct repository *r, enum list_objects_filter_situation filter_situation, struct object *obj, const char *pathname, const char *filename, - void *filter_data); - -typedef void (*filter_free_fn)(void *filter_data); + struct filter *filter); /* - * Constructor for the set of defined list-objects filters. - * Returns a generic "void *filter_data". - * - * The returned "filter_fn" will be used by traverse_commit_list() - * to filter the results. - * - * The returned "filter_free_fn" is a destructor for the - * filter_data. + * Destroys `filter` and finalizes the `omitted` set, if present. Does + * nothing if `filter` is null. */ -void *list_objects_filter__init( - struct oidset *omitted, - struct list_objects_filter_options *filter_options, - filter_object_fn *filter_fn, - filter_free_fn *filter_free_fn); +void list_objects_filter__free(struct filter *filter); #endif /* LIST_OBJECTS_FILTER_H */ |
