From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> Add traverse_commit_list_filtered() wrapper around the various filter methods using common data in object_filter_options. Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> --- list-objects.c | 34 ++++++++++++++++++++++++++++++++++ list-objects.h | 11 +++++++++++ 2 files changed, 45 insertions(+) diff --git a/list-objects.c b/list-objects.c index 3e86008..0f063d9 100644 --- a/list-objects.c +++ b/list-objects.c @@ -7,6 +7,9 @@ #include "tree-walk.h" #include "revision.h" #include "list-objects.h" +#include "list-objects-filter-all.h" +#include "list-objects-filter-large.h" +#include "list-objects-filter-sparse.h" static void process_blob(struct rev_info *revs, struct blob *blob, @@ -266,3 +269,34 @@ void traverse_commit_list(struct rev_info *revs, show_commit, show_object, show_data, NULL, NULL); } + +void traverse_commit_list_filtered( + struct object_filter_options *filter_options, + struct rev_info *revs, + show_commit_fn show_commit, + show_object_fn show_object, + oidset2_foreach_cb print_omitted_object, + void *show_data) +{ + if (filter_options->omit_all_blobs) + traverse_commit_list_omit_all_blobs( + revs, show_commit, show_object, print_omitted_object, show_data); + + else if (filter_options->omit_large_blobs) + traverse_commit_list_omit_large_blobs( + revs, show_commit, show_object, print_omitted_object, show_data, + (int64_t)(uint64_t)filter_options->large_byte_limit); + + else if (filter_options->use_blob) + traverse_commit_list_use_blob( + revs, show_commit, show_object, print_omitted_object, show_data, + &filter_options->sparse_oid); + + else if (filter_options->use_path) + traverse_commit_list_use_path( + revs, show_commit, show_object, print_omitted_object, show_data, + filter_options->sparse_value); + + else + die("unspecified list-objects filter"); +} diff --git a/list-objects.h b/list-objects.h index 39fcbb5..a8acedc 100644 --- a/list-objects.h +++ b/list-objects.h @@ -1,6 +1,9 @@ #ifndef LIST_OBJECTS_H #define LIST_OBJECTS_H +#include "oidset2.h" +#include "object-filter.h" + typedef void (*show_commit_fn)(struct commit *, void *); typedef void (*show_object_fn)(struct object *, const char *, void *); void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, void *); @@ -38,4 +41,12 @@ void traverse_commit_list_worker( show_commit_fn, show_object_fn, void *show_data, filter_object_fn filter, void *filter_data); +void traverse_commit_list_filtered( + struct object_filter_options *filter_options, + struct rev_info *revs, + show_commit_fn show_commit, + show_object_fn show_object, + oidset2_foreach_cb print_omitted_object, + void *show_data); + #endif -- 2.9.3