tree:<depth>: skip some trees even when collecting omits
[git/git.git] / list-objects-filter-options.h
CommitLineData
25ec7bca
JH
1#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
2#define LIST_OBJECTS_FILTER_OPTIONS_H
3
4#include "parse-options.h"
5
6/*
7 * The list of defined filters for list-objects.
8 */
9enum list_objects_filter_choice {
10 LOFC_DISABLED = 0,
11 LOFC_BLOB_NONE,
12 LOFC_BLOB_LIMIT,
c813a7c3 13 LOFC_TREE_DEPTH,
25ec7bca
JH
14 LOFC_SPARSE_OID,
15 LOFC_SPARSE_PATH,
16 LOFC__COUNT /* must be last */
17};
18
19struct list_objects_filter_options {
20 /*
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.
25 */
26 char *filter_spec;
27
28 /*
29 * 'choice' is determined by parsing the filter-spec. This indicates
30 * the filtering algorithm to use.
31 */
32 enum list_objects_filter_choice choice;
33
aa57b871
JH
34 /*
35 * Choice is LOFC_DISABLED because "--no-filter" was requested.
36 */
37 unsigned int no_filter : 1;
38
25ec7bca
JH
39 /*
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.
43 */
44 struct object_id *sparse_oid_value;
45 char *sparse_path_value;
46 unsigned long blob_limit_value;
c813a7c3 47 unsigned long tree_exclude_depth;
25ec7bca
JH
48};
49
50/* Normalized command line arguments */
51#define CL_ARG__FILTER "filter"
52
53int parse_list_objects_filter(
54 struct list_objects_filter_options *filter_options,
55 const char *arg);
56
57int opt_parse_list_objects_filter(const struct option *opt,
58 const char *arg, int unset);
59
60#define OPT_PARSE_LIST_OBJECTS_FILTER(fo) \
61 { OPTION_CALLBACK, 0, CL_ARG__FILTER, fo, N_("args"), \
4875c979 62 N_("object filtering"), 0, \
25ec7bca
JH
63 opt_parse_list_objects_filter }
64
4875c979
JH
65void list_objects_filter_release(
66 struct list_objects_filter_options *filter_options);
67
aa57b871
JH
68static inline void list_objects_filter_set_no_filter(
69 struct list_objects_filter_options *filter_options)
70{
71 list_objects_filter_release(filter_options);
72 filter_options->no_filter = 1;
73}
74
1e1e39b3
JH
75void partial_clone_register(
76 const char *remote,
77 const struct list_objects_filter_options *filter_options);
78void partial_clone_get_default_filter_spec(
79 struct list_objects_filter_options *filter_options);
80
25ec7bca 81#endif /* LIST_OBJECTS_FILTER_OPTIONS_H */