read-cache: make the split index obey umask settings
[git.git] / list-objects-filter.h
bloba6f6b4990b43c8f4c8cb94ba5b890370287ec868
1 #ifndef LIST_OBJECTS_FILTER_H
2 #define LIST_OBJECTS_FILTER_H
4 struct list_objects_filter_options;
5 struct object;
6 struct oidset;
8 /*
9 * During list-object traversal we allow certain objects to be
10 * filtered (omitted) from the result. The active filter uses
11 * these result values to guide list-objects.
13 * _ZERO : Do nothing with the object at this time. It may
14 * be revisited if it appears in another place in
15 * the tree or in another commit during the overall
16 * traversal.
18 * _MARK_SEEN : Mark this object as "SEEN" in the object flags.
19 * This will prevent it from being revisited during
20 * the remainder of the traversal. This DOES NOT
21 * imply that it will be included in the results.
23 * _DO_SHOW : Show this object in the results (call show() on it).
24 * In general, objects should only be shown once, but
25 * this result DOES NOT imply that we mark it SEEN.
27 * Most of the time, you want the combination (_MARK_SEEN | _DO_SHOW)
28 * but they can be used independently, such as when sparse-checkout
29 * pattern matching is being applied.
31 * A _MARK_SEEN without _DO_SHOW can be called a hard-omit -- the
32 * object is not shown and will never be reconsidered (unless a
33 * previous iteration has already shown it).
35 * A _DO_SHOW without _MARK_SEEN can be used, for example, to
36 * include a directory, but then revisit it to selectively include
37 * or omit objects within it.
39 * A _ZERO can be called a provisional-omit -- the object is NOT shown,
40 * but *may* be revisited (if the object appears again in the traversal).
41 * Therefore, it will be omitted from the results *unless* a later
42 * iteration causes it to be shown.
44 enum list_objects_filter_result {
45 LOFR_ZERO = 0,
46 LOFR_MARK_SEEN = 1<<0,
47 LOFR_DO_SHOW = 1<<1,
50 enum list_objects_filter_situation {
51 LOFS_BEGIN_TREE,
52 LOFS_END_TREE,
53 LOFS_BLOB
56 typedef enum list_objects_filter_result (*filter_object_fn)(
57 enum list_objects_filter_situation filter_situation,
58 struct object *obj,
59 const char *pathname,
60 const char *filename,
61 void *filter_data);
63 typedef void (*filter_free_fn)(void *filter_data);
66 * Constructor for the set of defined list-objects filters.
67 * Returns a generic "void *filter_data".
69 * The returned "filter_fn" will be used by traverse_commit_list()
70 * to filter the results.
72 * The returned "filter_free_fn" is a destructor for the
73 * filter_data.
75 void *list_objects_filter__init(
76 struct oidset *omitted,
77 struct list_objects_filter_options *filter_options,
78 filter_object_fn *filter_fn,
79 filter_free_fn *filter_free_fn);
81 #endif /* LIST_OBJECTS_FILTER_H */