Merge branch 'es/doc-worktree-guessremote-config'
[git.git] / list-objects-filter-options.h
blobaf64e5c66fc4a242f9cc534380a9b3e8f1e67d00
1 #ifndef LIST_OBJECTS_FILTER_OPTIONS_H
2 #define LIST_OBJECTS_FILTER_OPTIONS_H
4 #include "parse-options.h"
6 /*
7 * The list of defined filters for list-objects.
8 */
9 enum list_objects_filter_choice {
10 LOFC_DISABLED = 0,
11 LOFC_BLOB_NONE,
12 LOFC_BLOB_LIMIT,
13 LOFC_TREE_NONE,
14 LOFC_SPARSE_OID,
15 LOFC_SPARSE_PATH,
16 LOFC__COUNT /* must be last */
19 struct list_objects_filter_options {
21 * 'filter_spec' is the raw argument value given on the command line
22 * or protocol request. (The part after the "--keyword=".) For
23 * commands that launch filtering sub-processes, this value should be
24 * passed to them as received by the current process.
26 char *filter_spec;
29 * 'choice' is determined by parsing the filter-spec. This indicates
30 * the filtering algorithm to use.
32 enum list_objects_filter_choice choice;
35 * Choice is LOFC_DISABLED because "--no-filter" was requested.
37 unsigned int no_filter : 1;
40 * Parsed values (fields) from within the filter-spec. These are
41 * choice-specific; not all values will be defined for any given
42 * choice.
44 struct object_id *sparse_oid_value;
45 char *sparse_path_value;
46 unsigned long blob_limit_value;
49 /* Normalized command line arguments */
50 #define CL_ARG__FILTER "filter"
52 int parse_list_objects_filter(
53 struct list_objects_filter_options *filter_options,
54 const char *arg);
56 int opt_parse_list_objects_filter(const struct option *opt,
57 const char *arg, int unset);
59 #define OPT_PARSE_LIST_OBJECTS_FILTER(fo) \
60 { OPTION_CALLBACK, 0, CL_ARG__FILTER, fo, N_("args"), \
61 N_("object filtering"), 0, \
62 opt_parse_list_objects_filter }
64 void list_objects_filter_release(
65 struct list_objects_filter_options *filter_options);
67 static inline void list_objects_filter_set_no_filter(
68 struct list_objects_filter_options *filter_options)
70 list_objects_filter_release(filter_options);
71 filter_options->no_filter = 1;
74 void partial_clone_register(
75 const char *remote,
76 const struct list_objects_filter_options *filter_options);
77 void partial_clone_get_default_filter_spec(
78 struct list_objects_filter_options *filter_options);
80 #endif /* LIST_OBJECTS_FILTER_OPTIONS_H */