path: root/list-objects-filter.h
diff options
authorMatthew DeVore <>2019-06-27 22:54:08 (GMT)
committerJunio C Hamano <>2019-06-28 15:41:53 (GMT)
commite987df5fe62b8b29be4cdcdeb3704681ada2b29e (patch)
tree682c4340314a908de1baaf9bb31d894e077193d7 /list-objects-filter.h
parent842b00516aebee06fc99c51a663b6587f642d36d (diff)
list-objects-filter: implement composite filters
Allow combining filters such that only objects accepted by all filters are shown. The motivation for this is to allow getting directory listings without also fetching blobs. This can be done by combining blob:none with tree:<depth>. There are massive repositories that have larger-than-expected trees - even if you include only a single commit. A combined filter supports any number of subfilters, and is written in the following form: combine:<filter 1>+<filter 2>+<filter 3> Certain non-alphanumeric characters in each filter must be URL-encoded. For now, combined filters must be specified in this form. In a subsequent commit, rev-list will support multiple --filter arguments which will have the same effect as specifying one filter argument starting with "combine:". The documentation will be updated in that commit, as the URL-encoding scheme is in general not meant to be used directly by the user, and it is better to describe the URL-encoding feature in terms of the repeated flag. Helped-by: Emily Shaffer <> Helped-by: Jeff Hostetler <> Helped-by: Johannes Schindelin <> Helped-by: Jonathan Tan <> Helped-by: Junio C Hamano <> Signed-off-by: Matthew DeVore <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'list-objects-filter.h')
1 files changed, 11 insertions, 2 deletions
diff --git a/list-objects-filter.h b/list-objects-filter.h
index 6908954..cfd784e 100644
--- a/list-objects-filter.h
+++ b/list-objects-filter.h
@@ -62,7 +62,13 @@ enum list_objects_filter_situation {
struct filter;
-/* Constructor for the set of defined list-objects filters. */
+ * 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);
@@ -80,7 +86,10 @@ enum list_objects_filter_result list_objects_filter__filter_object(
const char *filename,
struct filter *filter);
-/* Destroys `filter`. Does nothing if `filter` is null. */
+ * Destroys `filter` and finalizes the `omitted` set, if present. Does
+ * nothing if `filter` is null.
+ */
void list_objects_filter__free(struct filter *filter);