git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
blob ee807f5d9bbb105b1c5c21f19905b71897d415fd 3201 bytes (raw)
name: list-objects-filter.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
#ifndef LIST_OBJECTS_FILTER_H
#define LIST_OBJECTS_FILTER_H

struct list_objects_filter_options;
struct object;
struct oidset;
struct repository;

/*
 * During list-object traversal we allow certain objects to be
 * filtered (omitted) from the result.  The active filter uses
 * these result values to guide list-objects.
 *
 * _ZERO      : Do nothing with the object at this time.  It may
 *              be revisited if it appears in another place in
 *              the tree or in another commit during the overall
 *              traversal.
 *
 * _MARK_SEEN : Mark this object as "SEEN" in the object flags.
 *              This will prevent it from being revisited during
 *              the remainder of the traversal.  This DOES NOT
 *              imply that it will be included in the results.
 *
 * _DO_SHOW   : Show this object in the results (call show() on it).
 *              In general, objects should only be shown once, but
 *              this result DOES NOT imply that we mark it SEEN.
 *
 * _SKIP_TREE : Used in LOFS_BEGIN_TREE situation - indicates that
 *              the tree's children should not be iterated over. This
 *              is used as an optimization when all children will
 *              definitely be ignored.
 *
 * Most of the time, you want the combination (_MARK_SEEN | _DO_SHOW)
 * but they can be used independently, such as when sparse-checkout
 * pattern matching is being applied.
 *
 * A _MARK_SEEN without _DO_SHOW can be called a hard-omit -- the
 * object is not shown and will never be reconsidered (unless a
 * previous iteration has already shown it).
 *
 * A _DO_SHOW without _MARK_SEEN can be used, for example, to
 * include a directory, but then revisit it to selectively include
 * or omit objects within it.
 *
 * A _ZERO can be called a provisional-omit -- the object is NOT shown,
 * but *may* be revisited (if the object appears again in the traversal).
 * Therefore, it will be omitted from the results *unless* a later
 * iteration causes it to be shown.
 */
enum list_objects_filter_result {
	LOFR_ZERO      = 0,
	LOFR_MARK_SEEN = 1<<0,
	LOFR_DO_SHOW   = 1<<1,
	LOFR_SKIP_TREE = 1<<2,
};

enum list_objects_filter_situation {
	LOFS_BEGIN_TREE,
	LOFS_END_TREE,
	LOFS_BLOB
};

struct filter_context {
	enum list_objects_filter_result (*filter_fn)(
		struct repository *r,
		enum list_objects_filter_situation filter_situation,
		struct object *obj,
		const char *pathname,
		const char *filename,
		struct filter_context *ctx);
	void (*free_fn)(void *filter_data);

	struct oidset *omits;
	void *data;
};

/*
 * 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.
 */
void list_objects_filter__init(
	struct oidset *omitted,
	struct list_objects_filter_options *filter_options,
	struct filter_context *ctx);

static inline void list_objects_filter__release(struct filter_context *ctx) {
	if (ctx->data && ctx->free_fn)
		ctx->free_fn(ctx->data);
	memset(ctx, 0, sizeof(*ctx));
}

#endif /* LIST_OBJECTS_FILTER_H */

debug log:

solving ee807f5d9b ...
found ee807f5d9b in https://public-inbox.org/git/341bc55d4a3f5438b1523525cf683f96d75e8c3e.1558030802.git.matvore@google.com/ ||
	https://public-inbox.org/git/341bc55d4a3f5438b1523525cf683f96d75e8c3e.1558484115.git.matvore@google.com/
found 1d45a4ad57 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 1d45a4ad5786c915f1fd597ce782cd96b7301532	list-objects-filter.h

applying [1/1] https://public-inbox.org/git/341bc55d4a3f5438b1523525cf683f96d75e8c3e.1558030802.git.matvore@google.com/
diff --git a/list-objects-filter.h b/list-objects-filter.h
index 1d45a4ad57..ee807f5d9b 100644

Checking patch list-objects-filter.h...
Applied patch list-objects-filter.h cleanly.

skipping https://public-inbox.org/git/341bc55d4a3f5438b1523525cf683f96d75e8c3e.1558484115.git.matvore@google.com/ for ee807f5d9b
index at:
100644 ee807f5d9bbb105b1c5c21f19905b71897d415fd	list-objects-filter.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).