refs: replace `refs_for_each_namespaced_ref()`
Replace calls to `refs_for_each_namespaced_ref()` 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>
Patrick Steinhardt committed
Feb 23, 2026 at 12:59 UTC
96c35a9ba5f1b5afac1e30ca93815dcd540d8b16
4 files changed
+13
-25
http-backend.c
+6
-2
@@ -565,9 +565,13 @@ static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
565
run_service(argv, 0);
566
567
} else {
568
+ struct refs_for_each_ref_options opts = {
569
+ .namespace = get_git_namespace(),
570
+ };
571
+
572
select_getanyfile(hdr);
569
- refs_for_each_namespaced_ref(get_main_ref_store(the_repository),
570
- NULL, show_text_ref, &buf);
573
+ refs_for_each_ref_ext(get_main_ref_store(the_repository),
574
+ show_text_ref, &buf, &opts);
575
send_strbuf(hdr, "text/plain", &buf);
576
}
577
strbuf_release(&buf);
refs.c
-11
@@ -1951,17 +1951,6 @@ int refs_for_each_replace_ref(struct ref_store *refs, refs_for_each_cb cb, void
1951
return refs_for_each_ref_ext(refs, cb, cb_data, &opts);
1952
}
1953
1954
-int refs_for_each_namespaced_ref(struct ref_store *refs,
1955
- const char **exclude_patterns,
1956
- refs_for_each_cb cb, void *cb_data)
1957
-{
1958
- struct refs_for_each_ref_options opts = {
1959
- .exclude_patterns = exclude_patterns,
1960
- .namespace = get_git_namespace(),
1961
- };
1962
- return refs_for_each_ref_ext(refs, cb, cb_data, &opts);
1963
-}
1964
-
1954
static int qsort_strcmp(const void *va, const void *vb)
1955
{
1956
const char *a = *(const char **)va;
refs.h
-8
@@ -527,14 +527,6 @@ int refs_for_each_ref_in_prefixes(struct ref_store *refs,
527
const struct refs_for_each_ref_options *opts,
528
refs_for_each_cb cb, void *cb_data);
529
530
-/*
531
- * references matching any pattern in "exclude_patterns" are omitted from the
532
- * result set on a best-effort basis.
533
- */
534
-int refs_for_each_namespaced_ref(struct ref_store *refs,
535
- const char **exclude_patterns,
536
- refs_for_each_cb fn, void *cb_data);
537
-
530
/*
531
* Normalizes partial refs to their fully qualified form.
532
* Will prepend <prefix> to the <pattern> if it doesn't start with 'refs/'.
upload-pack.c
+7
-4
@@ -610,7 +610,10 @@ static int allow_hidden_refs(enum allow_uor allow_uor)
610
static void for_each_namespaced_ref_1(refs_for_each_cb fn,
611
struct upload_pack_data *data)
612
{
613
- const char **excludes = NULL;
613
+ struct refs_for_each_ref_options opts = {
614
+ .namespace = get_git_namespace(),
615
+ };
616
+
617
/*
618
* If `data->allow_uor` allows fetching hidden refs, we need to
619
* mark all references (including hidden ones), to check in
@@ -621,10 +624,10 @@ static void for_each_namespaced_ref_1(refs_for_each_cb fn,
624
* hidden references.
625
*/
626
if (allow_hidden_refs(data->allow_uor))
624
- excludes = hidden_refs_to_excludes(&data->hidden_refs);
627
+ opts.exclude_patterns = hidden_refs_to_excludes(&data->hidden_refs);
628
626
- refs_for_each_namespaced_ref(get_main_ref_store(the_repository),
627
- excludes, fn, data);
629
+ refs_for_each_ref_ext(get_main_ref_store(the_repository),
630
+ fn, data, &opts);
631
}
632
633