]> git.ipfire.org Git - thirdparty/git.git/commit
list-objects-filter: encapsulate filter components
authorMatthew DeVore <matvore@google.com>
Thu, 27 Jun 2019 22:54:05 +0000 (15:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Jun 2019 15:41:53 +0000 (08:41 -0700)
commit9430147ca0aab0189d7e52df97b95a0985fc0c8a
tree063bbf5b2d710466c1e34bdffcdc2b3a59f5fc71
parent8dca754b1e874719a732bc9ab7b0e14b21b1bc10
list-objects-filter: encapsulate filter components

Encapsulate filter_fn, filter_free_fn, and filter_data into their own
opaque struct.

Due to opaqueness, filter_fn and filter_free_fn can no longer be
accessed directly by users. Currently, all usages of filter_fn are
guarded by a necessary check:

(obj->flags & NOT_USER_GIVEN) && filter_fn

Take the opportunity to include this check into the new function
list_objects_filter__filter_object(), so that we no longer need to write
this check at every caller of the filter function.

Also, the init functions in list-objects-filter.c no longer need to
confusingly return the filter constituents in various places (filter_fn
and filter_free_fn as out parameters, and filter_data as the function's
return value); they can just initialize the "struct filter" passed in.

Helped-by: Jeff Hostetler <git@jeffhostetler.com>
Helped-by: Jonathan Tan <jonathantanmy@google.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
list-objects-filter.c
list-objects-filter.h
list-objects.c