cocci: apply rules to rewrite callers of "refs" interfaces

Apply the rules that rewrite callers of "refs" interfaces to explicitly
pass `struct ref_store`. The resulting patch has been applied with the
`--whitespace=fix` option.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-05-07 09:11:53 +02:00
committed by Junio C Hamano
parent b198ee0b3d
commit 2e5c4758b7
75 changed files with 711 additions and 436 deletions

View File

@ -129,7 +129,8 @@ static int cmd_show_ref__exclude_existing(const struct exclude_existing_options
char buf[1024];
int patternlen = opts->pattern ? strlen(opts->pattern) : 0;
for_each_ref(add_existing, &existing_refs);
refs_for_each_ref(get_main_ref_store(the_repository), add_existing,
&existing_refs);
while (fgets(buf, sizeof(buf), stdin)) {
char *ref;
int len = strlen(buf);
@ -173,7 +174,7 @@ static int cmd_show_ref__verify(const struct show_one_options *show_one_opts,
struct object_id oid;
if ((starts_with(*refs, "refs/") || refname_is_safe(*refs)) &&
!read_ref(*refs, &oid)) {
!refs_read_ref(get_main_ref_store(the_repository), *refs, &oid)) {
show_one(show_one_opts, *refs, &oid);
}
else if (!show_one_opts->quiet)
@ -205,14 +206,20 @@ static int cmd_show_ref__patterns(const struct patterns_options *opts,
show_ref_data.patterns = patterns;
if (opts->show_head)
head_ref(show_ref, &show_ref_data);
refs_head_ref(get_main_ref_store(the_repository), show_ref,
&show_ref_data);
if (opts->heads_only || opts->tags_only) {
if (opts->heads_only)
for_each_fullref_in("refs/heads/", NULL, show_ref, &show_ref_data);
refs_for_each_fullref_in(get_main_ref_store(the_repository),
"refs/heads/", NULL,
show_ref, &show_ref_data);
if (opts->tags_only)
for_each_fullref_in("refs/tags/", NULL, show_ref, &show_ref_data);
refs_for_each_fullref_in(get_main_ref_store(the_repository),
"refs/tags/", NULL, show_ref,
&show_ref_data);
} else {
for_each_ref(show_ref, &show_ref_data);
refs_for_each_ref(get_main_ref_store(the_repository),
show_ref, &show_ref_data);
}
if (!show_ref_data.found_match)
return 1;