Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/path-walk.h # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / path-walk.h` 118 lines ยท 3650 bytes Raw Blame History 1 /* 2 * path-walk.h : Methods and structures for walking the object graph in batches 3 * by the paths that can reach those objects. 4 */ 5 #include "object.h" /* Required for 'enum object_type'. */ 6 7 struct rev_info; 8 struct oid_array; 9 struct pattern_list; 10 11 /** 12 * The type of a function pointer for the method that is called on a list of 13 * objects reachable at a given path. 14 */ 15 typedef int (*path_fn)(const char *path, 16 struct oid_array *oids, 17 enum object_type type, 18 void *data); 19 20 struct path_walk_info { 21 /** 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. 25 */ 26 struct rev_info *revs; 27 28 /** 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. 32 */ 33 path_fn path_fn; 34 void *path_fn_data; 35 36 /** 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. 39 * 40 * Note: even when 'blobs' or 'trees' is disabled, objects that are 41 * directly requested as pending objects will still be emitted to 42 * path_fn. Only objects discovered during the tree walk are filtered by 43 * these flags. 44 */ 45 int commits; 46 int trees; 47 int blobs; 48 int tags; 49 50 /** 51 * If 'strict_types' is 0, then direct object requests will no longer 52 * override the object type restrictions. 53 */ 54 int strict_types; 55 56 /** 57 * If non-zero, specifies a maximum blob size. Blobs with a 58 * size equal to or greater than this limit will not be 59 * emitted unless included in 'pending'. 60 */ 61 unsigned long blob_limit; 62 63 /** 64 * When 'prune_all_uninteresting' is set and a path has all objects 65 * marked as UNINTERESTING, then the path-walk will not visit those 66 * objects. It will not call path_fn on those objects and will not 67 * walk the children of such trees. 68 */ 69 int prune_all_uninteresting; 70 71 /** 72 * When 'edge_aggressive' is set, then the revision walk will use 73 * the '--object-edge-aggressive' option to mark even more objects 74 * as uninteresting. 75 */ 76 int edge_aggressive; 77 78 /** 79 * Specify a sparse-checkout definition to match our paths to. Do not 80 * walk outside of this sparse definition. If the patterns are in 81 * cone mode, then the search may prune directories that are outside 82 * of the cone. If not in cone mode, then all tree paths will be 83 * explored but the path_fn will only be called when the path matches 84 * the sparse-checkout patterns. 85 * 86 * When 'pl_sparse_trees' is zero, the sparse patterns only restrict 87 * blobs and all trees are included in the walk output. This matches 88 * the behavior of the sparse:oid object filter. When nonzero, trees 89 * are also pruned by the sparse patterns (as used by backfill). 90 */ 91 struct pattern_list *pl; 92 int pl_sparse_trees; 93 }; 94 95 #define PATH_WALK_INFO_INIT { \ 96 .blobs = 1, \ 97 .trees = 1, \ 98 .commits = 1, \ 99 .tags = 1, \ 100 } 101 102 void path_walk_info_init(struct path_walk_info *info); 103 void path_walk_info_clear(struct path_walk_info *info); 104 105 /** 106 * Given the configuration of 'info', walk the commits based on 'info->revs' and 107 * call 'info->path_fn' on each discovered path. 108 * 109 * Returns nonzero on an error. 110 */ 111 int walk_objects_by_path(struct path_walk_info *info); 112 113 struct list_objects_filter_options; 114 /** 115 * Given a set of options for filtering objects, return 1 if the options 116 * are compatible with the path-walk API and 0 otherwise. 117 */ 118 int path_walk_filter_compatible(struct list_objects_filter_options *options);