refs: move `do_for_each_ref_flags` further up

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>

Patrick Steinhardt committed Feb 23, 2026 at 12:59 UTC 1c3aff34b88f132ba3d489dbd9ff30f2604bb871
1 file changed +37 -37
refs.h
+37 -37
@@ -402,6 +402,43 @@ int reference_get_peeled_oid(struct repository *repo,
402 */
403 typedef int each_ref_fn(const struct reference *ref, void *cb_data);
404
405 +/*
406 + * These flags are passed to refs_ref_iterator_begin() (and do_for_each_ref(),
407 + * which feeds it).
408 + */
409 +enum do_for_each_ref_flags {
410 + /*
411 + * Include broken references in a do_for_each_ref*() iteration, which
412 + * would normally be omitted. This includes both refs that point to
413 + * missing objects (a true repository corruption), ones with illegal
414 + * names (which we prefer not to expose to callers), as well as
415 + * dangling symbolic refs (i.e., those that point to a non-existent
416 + * ref; this is not a corruption, but as they have no valid oid, we
417 + * omit them from normal iteration results).
418 + */
419 + DO_FOR_EACH_INCLUDE_BROKEN = (1 << 0),
420 +
421 + /*
422 + * Only include per-worktree refs in a do_for_each_ref*() iteration.
423 + * Normally this will be used with a files ref_store, since that's
424 + * where all reference backends will presumably store their
425 + * per-worktree refs.
426 + */
427 + DO_FOR_EACH_PER_WORKTREE_ONLY = (1 << 1),
428 +
429 + /*
430 + * Omit dangling symrefs from output; this only has an effect with
431 + * INCLUDE_BROKEN, since they are otherwise not included at all.
432 + */
433 + DO_FOR_EACH_OMIT_DANGLING_SYMREFS = (1 << 2),
434 +
435 + /*
436 + * Include root refs i.e. HEAD and pseudorefs along with the regular
437 + * refs.
438 + */
439 + DO_FOR_EACH_INCLUDE_ROOT_REFS = (1 << 3),
440 +};
441 +
442 /*
443 * The following functions invoke the specified callback function for
444 * each reference indicated. If the function ever returns a nonzero
@@ -1326,43 +1363,6 @@ int repo_migrate_ref_storage_format(struct repository *repo,
1363 */
1364 struct ref_iterator;
1365
1329 -/*
1330 - * These flags are passed to refs_ref_iterator_begin() (and do_for_each_ref(),
1331 - * which feeds it).
1332 - */
1333 -enum do_for_each_ref_flags {
1334 - /*
1335 - * Include broken references in a do_for_each_ref*() iteration, which
1336 - * would normally be omitted. This includes both refs that point to
1337 - * missing objects (a true repository corruption), ones with illegal
1338 - * names (which we prefer not to expose to callers), as well as
1339 - * dangling symbolic refs (i.e., those that point to a non-existent
1340 - * ref; this is not a corruption, but as they have no valid oid, we
1341 - * omit them from normal iteration results).
1342 - */
1343 - DO_FOR_EACH_INCLUDE_BROKEN = (1 << 0),
1344 -
1345 - /*
1346 - * Only include per-worktree refs in a do_for_each_ref*() iteration.
1347 - * Normally this will be used with a files ref_store, since that's
1348 - * where all reference backends will presumably store their
1349 - * per-worktree refs.
1350 - */
1351 - DO_FOR_EACH_PER_WORKTREE_ONLY = (1 << 1),
1352 -
1353 - /*
1354 - * Omit dangling symrefs from output; this only has an effect with
1355 - * INCLUDE_BROKEN, since they are otherwise not included at all.
1356 - */
1357 - DO_FOR_EACH_OMIT_DANGLING_SYMREFS = (1 << 2),
1358 -
1359 - /*
1360 - * Include root refs i.e. HEAD and pseudorefs along with the regular
1361 - * refs.
1362 - */
1363 - DO_FOR_EACH_INCLUDE_ROOT_REFS = (1 << 3),
1364 -};
1365 -
1366 /*
1367 * Return an iterator that goes over each reference in `refs` for
1368 * which the refname begins with prefix. If trim is non-zero, then