Show 52 quoted lines
> Replace calls to `refs_for_each_ref_in()` with the newly introduced
> `refs_for_each_ref_ext()` function.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> bisect.c | 8 ++++++--
> builtin/rev-parse.c | 13 +++++++++----
> pack-bitmap.c | 13 +++++++------
> refs.c | 34 ++++++++++++++++++----------------
> refs.h | 2 --
> t/helper/test-ref-store.c | 7 +++++--
> 6 files changed, 45 insertions(+), 32 deletions(-)
>
> diff --git a/bisect.c b/bisect.c
> index 2bdad4ee42..296836c154 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -473,8 +473,12 @@ static int register_ref(const struct reference *ref, void *cb_data UNUSED)
>
> static int read_bisect_refs(void)
> {
> - return refs_for_each_ref_in(get_main_ref_store(the_repository),
> - "refs/bisect/", register_ref, NULL);
> + struct refs_for_each_ref_options opts = {
> + .prefix = "refs/bisect/",
> + .trim_prefix = strlen("refs/bisect/"),
> + };
> + return refs_for_each_ref_ext(get_main_ref_store(the_repository),
> + register_ref, NULL, &opts);
> }
>
> static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index 9032cc6327..02703f2fb8 100644
> --- a/builtin/rev-parse.c
> +++ b/builtin/rev-parse.c
> @@ -613,13 +613,18 @@ static int opt_with_value(const char *arg, const char *opt, const char **value)
>
> static void handle_ref_opt(const char *pattern, const char *prefix)
> {
> - if (pattern)
> + if (pattern) {
> refs_for_each_glob_ref_in(get_main_ref_store(the_repository),
> show_reference, pattern, prefix,
> NULL);
> - else
> - refs_for_each_ref_in(get_main_ref_store(the_repository),
> - prefix, show_reference, NULL);
> + } else {
> + struct refs_for_each_ref_options opts = {
> + .prefix = prefix,
> + .trim_prefix = strlen(prefix),