2 * path-walk.h : Methods and structures for walking the object graph in batches
3 * by the paths that can reach those objects.
5 #include "object.h" /* Required for 'enum object_type'. */
12 * The type of a function pointer for the method that is called on a list of
13 * objects reachable at a given path.
15 typedef int (*path_fn
)(const char *path
,
16 struct oid_array
*oids
,
17 enum object_type type
,
20 struct path_walk_info
{
22 * revs provides the definitions for the commit walk, including
23 * which commits are UNINTERESTING or not. This structure is
24 * expected to be owned by the caller.
26 struct rev_info
*revs
;
29 * The caller wishes to execute custom logic on objects reachable at a
30 * given path. Every reachable object will be visited exactly once, and
31 * the first path to see an object wins. This may not be a stable choice.
37 * Initialize which object types the path_fn should be called on. This
38 * could also limit the walk to skip blobs if not set.
46 * When 'prune_all_uninteresting' is set and a path has all objects
47 * marked as UNINTERESTING, then the path-walk will not visit those
48 * objects. It will not call path_fn on those objects and will not
49 * walk the children of such trees.
51 int prune_all_uninteresting
;
54 * When 'edge_aggressive' is set, then the revision walk will use
55 * the '--object-edge-aggressive' option to mark even more objects
61 * Specify a sparse-checkout definition to match our paths to. Do not
62 * walk outside of this sparse definition. If the patterns are in
63 * cone mode, then the search may prune directories that are outside
64 * of the cone. If not in cone mode, then all tree paths will be
65 * explored but the path_fn will only be called when the path matches
66 * the sparse-checkout patterns.
68 struct pattern_list
*pl
;
71 #define PATH_WALK_INFO_INIT { \
78 void path_walk_info_init(struct path_walk_info
*info
);
79 void path_walk_info_clear(struct path_walk_info
*info
);
82 * Given the configuration of 'info', walk the commits based on 'info->revs' and
83 * call 'info->path_fn' on each discovered path.
85 * Returns nonzero on an error.
87 int walk_objects_by_path(struct path_walk_info
*info
);