aboutsummaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-02-23 12:59:45 +0100
committerJunio C Hamano <gitster@pobox.com>2026-02-23 13:21:18 -0800
commit00be226f1f2a1036ea3920f8700b23b7cc55bf57 (patch)
tree34cf7daa6ad015c32e8400fbf99747461cc3c151 /builtin/rev-parse.c
parent5507200b504f478516bf93767ac3ed3bebed7226 (diff)
downloadgit-00be226f1f2a1036ea3920f8700b23b7cc55bf57.tar.xz
refs: replace `refs_for_each_ref_in()`
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c13
1 files changed, 9 insertions, 4 deletions
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),
+ };
+ refs_for_each_ref_ext(get_main_ref_store(the_repository),
+ show_reference, NULL, &opts);
+ }
clear_ref_exclusions(&ref_excludes);
}