diff options
author | Derrick Stolee <derrickstolee@github.com> | 2022-03-09 17:01:36 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-09 19:25:27 +0100 |
commit | 3e0370a8d2251742d583ce095072b7dcc34b3c01 (patch) | |
tree | 4d5e7d29c452261687da3a1bcae66fb35fa2b338 /list-objects.c | |
parent | pack-bitmap: drop filter in prepare_bitmap_walk() (diff) | |
download | git-3e0370a8d2251742d583ce095072b7dcc34b3c01.tar.xz git-3e0370a8d2251742d583ce095072b7dcc34b3c01.zip |
list-objects: consolidate traverse_commit_list[_filtered]
Now that all consumers of traverse_commit_list_filtered() populate the
'filter' member of 'struct rev_info', we can drop that parameter from
the method prototype to simplify things. In addition, the only thing
different now between traverse_commit_list_filtered() and
traverse_commit_list() is the presence of the 'omitted' parameter, which
is only non-NULL for one caller. We can consolidate these two methods by
having one call the other and use the simpler form everywhere the
'omitted' parameter would be NULL.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects.c')
-rw-r--r-- | list-objects.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/list-objects.c b/list-objects.c index 2f623f8211..117f734398 100644 --- a/list-objects.c +++ b/list-objects.c @@ -416,35 +416,25 @@ static void do_traverse(struct traversal_context *ctx) strbuf_release(&csp); } -void traverse_commit_list(struct rev_info *revs, - show_commit_fn show_commit, - show_object_fn show_object, - void *show_data) -{ - struct traversal_context ctx; - ctx.revs = revs; - ctx.show_commit = show_commit; - ctx.show_object = show_object; - ctx.show_data = show_data; - ctx.filter = NULL; - do_traverse(&ctx); -} - void traverse_commit_list_filtered( - struct list_objects_filter_options *filter_options, struct rev_info *revs, show_commit_fn show_commit, show_object_fn show_object, void *show_data, struct oidset *omitted) { - struct traversal_context ctx; + struct traversal_context ctx = { + .revs = revs, + .show_object = show_object, + .show_commit = show_commit, + .show_data = show_data, + }; + + if (revs->filter.choice) + ctx.filter = list_objects_filter__init(omitted, &revs->filter); - ctx.revs = revs; - ctx.show_object = show_object; - ctx.show_commit = show_commit; - ctx.show_data = show_data; - ctx.filter = list_objects_filter__init(omitted, filter_options); do_traverse(&ctx); - list_objects_filter__free(ctx.filter); + + if (ctx.filter) + list_objects_filter__free(ctx.filter); } |