]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: move `do_for_each_ref_flags` further up
authorPatrick Steinhardt <ps@pks.im>
Mon, 23 Feb 2026 11:59:37 +0000 (12:59 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Feb 2026 21:21:17 +0000 (13:21 -0800)
Move the `do_for_each_ref_flags` enum further up. This prepares for
subsequent changes, where the flags will be used by more functions.

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 718212a5d7fb4379d470018f63dde3cafc59f947..6fd7a706b5bdaa8e86521fb4adabd1db540f3779 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -402,6 +402,43 @@ int reference_get_peeled_oid(struct repository *repo,
  */
 typedef int each_ref_fn(const struct reference *ref, void *cb_data);
 
+/*
+ * These flags are passed to refs_ref_iterator_begin() (and do_for_each_ref(),
+ * which feeds it).
+ */
+enum do_for_each_ref_flags {
+       /*
+        * Include broken references in a do_for_each_ref*() iteration, which
+        * would normally be omitted. This includes both refs that point to
+        * missing objects (a true repository corruption), ones with illegal
+        * names (which we prefer not to expose to callers), as well as
+        * dangling symbolic refs (i.e., those that point to a non-existent
+        * ref; this is not a corruption, but as they have no valid oid, we
+        * omit them from normal iteration results).
+        */
+       DO_FOR_EACH_INCLUDE_BROKEN = (1 << 0),
+
+       /*
+        * Only include per-worktree refs in a do_for_each_ref*() iteration.
+        * Normally this will be used with a files ref_store, since that's
+        * where all reference backends will presumably store their
+        * per-worktree refs.
+        */
+       DO_FOR_EACH_PER_WORKTREE_ONLY = (1 << 1),
+
+       /*
+        * Omit dangling symrefs from output; this only has an effect with
+        * INCLUDE_BROKEN, since they are otherwise not included at all.
+        */
+       DO_FOR_EACH_OMIT_DANGLING_SYMREFS = (1 << 2),
+
+       /*
+        * Include root refs i.e. HEAD and pseudorefs along with the regular
+        * refs.
+        */
+       DO_FOR_EACH_INCLUDE_ROOT_REFS = (1 << 3),
+};
+
 /*
  * The following functions invoke the specified callback function for
  * each reference indicated.  If the function ever returns a nonzero
@@ -1326,43 +1363,6 @@ int repo_migrate_ref_storage_format(struct repository *repo,
  */
 struct ref_iterator;
 
-/*
- * These flags are passed to refs_ref_iterator_begin() (and do_for_each_ref(),
- * which feeds it).
- */
-enum do_for_each_ref_flags {
-       /*
-        * Include broken references in a do_for_each_ref*() iteration, which
-        * would normally be omitted. This includes both refs that point to
-        * missing objects (a true repository corruption), ones with illegal
-        * names (which we prefer not to expose to callers), as well as
-        * dangling symbolic refs (i.e., those that point to a non-existent
-        * ref; this is not a corruption, but as they have no valid oid, we
-        * omit them from normal iteration results).
-        */
-       DO_FOR_EACH_INCLUDE_BROKEN = (1 << 0),
-
-       /*
-        * Only include per-worktree refs in a do_for_each_ref*() iteration.
-        * Normally this will be used with a files ref_store, since that's
-        * where all reference backends will presumably store their
-        * per-worktree refs.
-        */
-       DO_FOR_EACH_PER_WORKTREE_ONLY = (1 << 1),
-
-       /*
-        * Omit dangling symrefs from output; this only has an effect with
-        * INCLUDE_BROKEN, since they are otherwise not included at all.
-        */
-       DO_FOR_EACH_OMIT_DANGLING_SYMREFS = (1 << 2),
-
-       /*
-        * Include root refs i.e. HEAD and pseudorefs along with the regular
-        * refs.
-        */
-       DO_FOR_EACH_INCLUDE_ROOT_REFS = (1 << 3),
-};
-
 /*
  * Return an iterator that goes over each reference in `refs` for
  * which the refname begins with prefix. If trim is non-zero, then