Git fork

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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
54876c6d 39a9ef8f

+16 -13
+2 -2
builtin/rev-parse.c
··· 908 908 continue; 909 909 } 910 910 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); 913 913 continue; 914 914 } 915 915 if (opt_with_value(arg, "--branches", &arg)) {
+2 -2
builtin/show-ref.c
··· 208 208 head_ref(show_ref, &show_ref_data); 209 209 if (opts->heads_only || opts->tags_only) { 210 210 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); 212 212 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); 214 214 } else { 215 215 for_each_ref(show_ref, &show_ref_data); 216 216 }
+5 -5
ref-filter.c
··· 2640 2640 * prefixes like "refs/heads/" etc. are stripped off, 2641 2641 * so we have to look at everything: 2642 2642 */ 2643 - return for_each_fullref_in("", cb, cb_data); 2643 + return for_each_fullref_in("", NULL, cb, cb_data); 2644 2644 } 2645 2645 2646 2646 if (filter->ignore_case) { ··· 2649 2649 * so just return everything and let the caller 2650 2650 * sort it out. 2651 2651 */ 2652 - return for_each_fullref_in("", cb, cb_data); 2652 + return for_each_fullref_in("", NULL, cb, cb_data); 2653 2653 } 2654 2654 2655 2655 if (!filter->name_patterns[0]) { ··· 3060 3060 * of filter_ref_kind(). 3061 3061 */ 3062 3062 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); 3064 3064 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); 3066 3066 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); 3068 3068 else if (filter->kind & FILTER_REFS_REGULAR) 3069 3069 ret = for_each_fullref_in_pattern(filter, fn, cb_data); 3070 3070
+5 -3
refs.c
··· 1742 1742 return refs_for_each_ref_in(get_main_ref_store(the_repository), prefix, fn, cb_data); 1743 1743 } 1744 1744 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) 1746 1748 { 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); 1749 1751 } 1750 1752 1751 1753 int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
+2 -1
refs.h
··· 353 353 int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix, 354 354 const char **exclude_patterns, 355 355 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); 357 358 358 359 /** 359 360 * iterate all refs in "patterns" by partitioning patterns into disjoint sets