summaryrefslogtreecommitdiff
path: root/builtin/show-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/show-ref.c')
-rw-r--r--builtin/show-ref.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index afb1030..8e25536 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -109,8 +109,10 @@ static int exclude_existing(const char *match)
static struct string_list existing_refs = STRING_LIST_INIT_DUP;
char buf[1024];
int matchlen = match ? strlen(match) : 0;
+ struct each_ref_fn_sha1_adapter wrapped_add_existing =
+ {add_existing, &existing_refs};
- for_each_ref(add_existing, &existing_refs);
+ for_each_ref(each_ref_fn_adapter, &wrapped_add_existing);
while (fgets(buf, sizeof(buf), stdin)) {
char *ref;
int len = strlen(buf);
@@ -191,6 +193,9 @@ static const struct option show_ref_options[] = {
int cmd_show_ref(int argc, const char **argv, const char *prefix)
{
+ struct each_ref_fn_sha1_adapter wrapped_show_ref =
+ {show_ref, NULL};
+
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(show_ref_usage, show_ref_options);
@@ -225,8 +230,8 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
}
if (show_head)
- head_ref(show_ref, NULL);
- for_each_ref(show_ref, NULL);
+ head_ref(each_ref_fn_adapter, &wrapped_show_ref);
+ for_each_ref(each_ref_fn_adapter, &wrapped_show_ref);
if (!found_match) {
if (verify && !quiet)
die("No match");