git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 08/16] refs-internal.h: move DO_FOR_EACH_* flags next to each other

From
Jeff King <peff@peff.net>
Date
Sep 24, 2021, 18:37 UTC
Message-ID
<YU4bBmkszJMyiqta@coredump.intra.peff.net>
In-Reply-To
<YU4ZOF9+ubmoItmK@coredump.intra.peff.net>

There are currently two DO_FOR_EACH_* flags, which must not have their bits overlap. Yet they're defined hundreds of lines apart. Let's move them next to each other to make it clear that they are related and are a complete set (which matters if you are adding a new flag and would like to know what the next available bit is).

Signed-off-by: Jeff King <peff@peff.net>
---
You can probably guess how I found this problem. :)
 refs/refs-internal.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 3155708345..7b30910974 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -248,6 +248,14 @@ int refs_rename_ref_available(struct ref_store *refs,
 /* Include broken references in a do_for_each_ref*() iteration: */
 #define DO_FOR_EACH_INCLUDE_BROKEN 0x01
 
+/*
+ * 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.
+ */
+#define DO_FOR_EACH_PER_WORKTREE_ONLY 0x02
+
 /*
  * Reference iterators
  *
@@ -498,14 +506,6 @@ int do_for_each_repo_ref_iterator(struct repository *r,
 				  struct ref_iterator *iter,
 				  each_repo_ref_fn fn, void *cb_data);
 
-/*
- * 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.
- */
-#define DO_FOR_EACH_PER_WORKTREE_ONLY 0x02
-
 struct ref_store;
 
 /* refs backends */
-- 
2.33.0.1071.gb37e412355
Previous: Jeff KingNext: Jeff King
Message 11 of 22 in “enabling GIT_REF_PARANOIA by default”
  1. 0/16 enabling GIT_REF_PARANOIA by defaultJeff King, Sep 24, 2021
  2. 01/16 t7900: clean up some more broken refsJeff King, Sep 24, 2021
  3. Jonathan TanSep 27, 2021
  4. Jeff KingSep 27, 2021
  5. 02/16 t5516: don't use HEAD ref for invalid ref-deletion testsJeff King, Sep 24, 2021
  6. 03/16 t5600: provide detached HEAD for corruption failuresJeff King, Sep 24, 2021
  7. 04/16 t5312: drop "verbose" helperJeff King, Sep 24, 2021
  8. 05/16 t5312: create bogus ref as necessaryJeff King, Sep 24, 2021
  9. 06/16 t5312: test non-destructive repackJeff King, Sep 24, 2021
  10. 07/16 t5312: be more assertive about command failureJeff King, Sep 24, 2021
  11. 08/16 refs-internal.h: move DO_FOR_EACH_* flags next to each otherJeff King, Sep 24, 2021
  12. 09/16 refs-internal.h: reorganize DO_FOR_EACH_* flag documentationJeff King, Sep 24, 2021
  13. 10/16 refs: add DO_FOR_EACH_OMIT_DANGLING_SYMREFS flagJeff King, Sep 24, 2021
  14. 11/16 refs: omit dangling symrefs when using GIT_REF_PARANOIAJeff King, Sep 24, 2021
  15. 12/16 refs: turn on GIT_REF_PARANOIA by defaultJeff King, Sep 24, 2021
  16. Jonathan TanSep 27, 2021
  17. 13/16 repack, prune: drop GIT_REF_PARANOIA settingsJeff King, Sep 24, 2021
  18. 14/16 ref-filter: stop setting FILTER_REFS_INCLUDE_BROKENJeff King, Sep 24, 2021
  19. 15/16 ref-filter: drop broken-ref code entirelyJeff King, Sep 24, 2021
  20. 16/16 refs: drop "broken" flag from for_each_fullref_in()Jeff King, Sep 24, 2021
  21. Jonathan TanSep 27, 2021
  22. Junio C HamanoSep 24, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.