aboutsummaryrefslogtreecommitdiffstats
path: root/path-walk.h
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2024-12-20 16:21:12 +0000
committerJunio C Hamano <gitster@pobox.com>2024-12-20 08:37:05 -0800
commitc8dba310d734962c0bcadd8cad1ebf7cfe734c8c (patch)
treeb594be4998d97ee2ff153c5c19f522a2f8410170 /path-walk.h
parentt6601: add helper for testing path-walk API (diff)
downloadgit-c8dba310d734962c0bcadd8cad1ebf7cfe734c8c.tar.gz
git-c8dba310d734962c0bcadd8cad1ebf7cfe734c8c.zip
path-walk: allow consumer to specify object types
We add the ability to filter the object types in the path-walk API so the callback function is called fewer times. This adds the ability to ask for the commits in a list, as well. We re-use the empty string for this set of objects because these are passed directly to the callback function instead of being part of the 'path_stack'. Future changes will add the ability to visit annotated tags. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path-walk.h')
-rw-r--r--path-walk.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/path-walk.h b/path-walk.h
index 7cb3538cd8..2cafc71e15 100644
--- a/path-walk.h
+++ b/path-walk.h
@@ -31,9 +31,21 @@ struct path_walk_info {
*/
path_fn path_fn;
void *path_fn_data;
+
+ /**
+ * Initialize which object types the path_fn should be called on. This
+ * could also limit the walk to skip blobs if not set.
+ */
+ int commits;
+ int trees;
+ int blobs;
};
-#define PATH_WALK_INFO_INIT { 0 }
+#define PATH_WALK_INFO_INIT { \
+ .blobs = 1, \
+ .trees = 1, \
+ .commits = 1, \
+}
void path_walk_info_init(struct path_walk_info *info);
void path_walk_info_clear(struct path_walk_info *info);