Skip to content

Commit 54876c6

Browse files
pks-tgitster
authored andcommitted
refs: add exclude_patterns parameter to for_each_fullref_in()
The `for_each_fullref_in()` function is supposedly the ref-store-less equivalent of `refs_for_each_fullref_in()`, but the latter has gained a new parameter `exclude_patterns` over time. Bring these two functions back in sync again by adding the parameter to the former function, as well. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 39a9ef8 commit 54876c6

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

builtin/rev-parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
908908
continue;
909909
}
910910
if (!strcmp(arg, "--bisect")) {
911-
for_each_fullref_in("refs/bisect/bad", show_reference, NULL);
912-
for_each_fullref_in("refs/bisect/good", anti_reference, NULL);
911+
for_each_fullref_in("refs/bisect/bad", NULL, show_reference, NULL);
912+
for_each_fullref_in("refs/bisect/good", NULL, anti_reference, NULL);
913913
continue;
914914
}
915915
if (opt_with_value(arg, "--branches", &arg)) {

builtin/show-ref.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ static int cmd_show_ref__patterns(const struct patterns_options *opts,
208208
head_ref(show_ref, &show_ref_data);
209209
if (opts->heads_only || opts->tags_only) {
210210
if (opts->heads_only)
211-
for_each_fullref_in("refs/heads/", show_ref, &show_ref_data);
211+
for_each_fullref_in("refs/heads/", NULL, show_ref, &show_ref_data);
212212
if (opts->tags_only)
213-
for_each_fullref_in("refs/tags/", show_ref, &show_ref_data);
213+
for_each_fullref_in("refs/tags/", NULL, show_ref, &show_ref_data);
214214
} else {
215215
for_each_ref(show_ref, &show_ref_data);
216216
}

ref-filter.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
26402640
* prefixes like "refs/heads/" etc. are stripped off,
26412641
* so we have to look at everything:
26422642
*/
2643-
return for_each_fullref_in("", cb, cb_data);
2643+
return for_each_fullref_in("", NULL, cb, cb_data);
26442644
}
26452645

26462646
if (filter->ignore_case) {
@@ -2649,7 +2649,7 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
26492649
* so just return everything and let the caller
26502650
* sort it out.
26512651
*/
2652-
return for_each_fullref_in("", cb, cb_data);
2652+
return for_each_fullref_in("", NULL, cb, cb_data);
26532653
}
26542654

26552655
if (!filter->name_patterns[0]) {
@@ -3060,11 +3060,11 @@ static int do_filter_refs(struct ref_filter *filter, unsigned int type, each_ref
30603060
* of filter_ref_kind().
30613061
*/
30623062
if (filter->kind == FILTER_REFS_BRANCHES)
3063-
ret = for_each_fullref_in("refs/heads/", fn, cb_data);
3063+
ret = for_each_fullref_in("refs/heads/", NULL, fn, cb_data);
30643064
else if (filter->kind == FILTER_REFS_REMOTES)
3065-
ret = for_each_fullref_in("refs/remotes/", fn, cb_data);
3065+
ret = for_each_fullref_in("refs/remotes/", NULL, fn, cb_data);
30663066
else if (filter->kind == FILTER_REFS_TAGS)
3067-
ret = for_each_fullref_in("refs/tags/", fn, cb_data);
3067+
ret = for_each_fullref_in("refs/tags/", NULL, fn, cb_data);
30683068
else if (filter->kind & FILTER_REFS_REGULAR)
30693069
ret = for_each_fullref_in_pattern(filter, fn, cb_data);
30703070

refs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,10 +1742,12 @@ int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)
17421742
return refs_for_each_ref_in(get_main_ref_store(the_repository), prefix, fn, cb_data);
17431743
}
17441744

1745-
int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data)
1745+
int for_each_fullref_in(const char *prefix,
1746+
const char **exclude_patterns,
1747+
each_ref_fn fn, void *cb_data)
17461748
{
1747-
return do_for_each_ref(get_main_ref_store(the_repository),
1748-
prefix, NULL, fn, 0, 0, cb_data);
1749+
return refs_for_each_fullref_in(get_main_ref_store(the_repository),
1750+
prefix, exclude_patterns, fn, cb_data);
17491751
}
17501752

17511753
int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,

refs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data);
353353
int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
354354
const char **exclude_patterns,
355355
each_ref_fn fn, void *cb_data);
356-
int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data);
356+
int for_each_fullref_in(const char *prefix, const char **exclude_patterns,
357+
each_ref_fn fn, void *cb_data);
357358

358359
/**
359360
* iterate all refs in "patterns" by partitioning patterns into disjoint sets

0 commit comments

Comments
 (0)