]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: move `refs_head_ref_namespaced()`
authorPatrick Steinhardt <ps@pks.im>
Mon, 23 Feb 2026 11:59:36 +0000 (12:59 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Feb 2026 21:21:17 +0000 (13:21 -0800)
The function `refs_head_ref_namespaced()` is somewhat special when
compared to most of the other functions that take a callback function:
while `refs_for_each_*()` functions yield multiple refs,
`refs_heasd_ref_namespaced()` will only yield at most the HEAD ref of
the current namespace. As such, the function is related to
`refs_head_ref()` and not to the for-each functions.

Move the function to be located next to `refs_head_ref()` to clarify.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.h

diff --git a/refs.h b/refs.h
index 1fdb809343a3f45cbb73a0765dbea28ec06dc757..718212a5d7fb4379d470018f63dde3cafc59f947 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -413,6 +413,9 @@ typedef int each_ref_fn(const struct reference *ref, void *cb_data);
  */
 int refs_head_ref(struct ref_store *refs,
                  each_ref_fn fn, void *cb_data);
+int refs_head_ref_namespaced(struct ref_store *refs,
+                            each_ref_fn fn, void *cb_data);
+
 int refs_for_each_ref(struct ref_store *refs,
                      each_ref_fn fn, void *cb_data);
 int refs_for_each_ref_in(struct ref_store *refs, const char *prefix,
@@ -456,8 +459,6 @@ int refs_for_each_glob_ref(struct ref_store *refs, each_ref_fn fn,
 int refs_for_each_glob_ref_in(struct ref_store *refs, each_ref_fn fn,
                              const char *pattern, const char *prefix, void *cb_data);
 
-int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_data);
-
 /*
  * references matching any pattern in "exclude_patterns" are omitted from the
  * result set on a best-effort basis.