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

[PATCH 13/16] replace-object.h: move read_replace_refs declaration from cache.h to here

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 23, 2023, 08:05 UTC
Message-ID
<1abea7621eeef18ee08868373ad498d1dcc73231.1677139522.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1485.git.1677139521.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

Adjust several files to be more explicit about their dependency on replace-objects to accommodate this change.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 builtin/cat-file.c       | 1 +
 builtin/commit-graph.c   | 1 +
 builtin/fsck.c           | 1 +
 builtin/index-pack.c     | 1 +
 builtin/pack-objects.c   | 1 +
 builtin/prune.c          | 1 +
 builtin/replace.c        | 1 +
 builtin/unpack-objects.c | 1 +
 builtin/upload-pack.c    | 1 +
 cache.h                  | 8 --------
 config.c                 | 1 +
 environment.c            | 1 +
 git.c                    | 1 +
 log-tree.c               | 1 +
 replace-object.h         | 9 ++++++++-
 15 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index fe1b5bab05b..8349eecfa4a 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -17,6 +17,7 @@
 #include "oid-array.h"
 #include "packfile.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "promisor-remote.h"
 #include "mailmap.h"
 
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 93704f95a9d..2a7d6ba4dda 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -7,6 +7,7 @@
 #include "commit-graph.h"
 #include "object-store.h"
 #include "progress.h"
+#include "replace-object.h"
 #include "tag.h"
 
 #define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d207bd909b4..fc6b848a41a 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -19,6 +19,7 @@
 #include "decorate.h"
 #include "packfile.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "resolve-undo.h"
 #include "run-command.h"
 #include "worktree.h"
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 7e4b69f9a3e..febd756bc06 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -15,6 +15,7 @@
 #include "thread-utils.h"
 #include "packfile.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "promisor-remote.h"
 
 static const char index_pack_usage[] =
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 72c33fd739a..aa724974030 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -31,6 +31,7 @@
 #include "list.h"
 #include "packfile.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "dir.h"
 #include "midx.h"
 #include "trace2.h"
diff --git a/builtin/prune.c b/builtin/prune.c
index 27192201086..d0add18ac03 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -7,6 +7,7 @@
 #include "parse-options.h"
 #include "progress.h"
 #include "prune-packed.h"
+#include "replace-object.h"
 #include "object-store.h"
 #include "shallow.h"
 
diff --git a/builtin/replace.c b/builtin/replace.c
index a29e911d309..95f7a1f96d5 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -15,6 +15,7 @@
 #include "parse-options.h"
 #include "run-command.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "repository.h"
 #include "tag.h"
 
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 43789b8ef29..1557d2bbe1b 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -8,6 +8,7 @@
 #include "pack.h"
 #include "blob.h"
 #include "commit.h"
+#include "replace-object.h"
 #include "tag.h"
 #include "tree.h"
 #include "tree-walk.h"
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index 25b69da2bf2..7a3c68720f1 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -4,6 +4,7 @@
 #include "pkt-line.h"
 #include "parse-options.h"
 #include "protocol.h"
+#include "replace-object.h"
 #include "upload-pack.h"
 #include "serve.h"
 
diff --git a/cache.h b/cache.h
index 774d8c6bdfd..7172fbce7ac 100644
--- a/cache.h
+++ b/cache.h
@@ -887,14 +887,6 @@ void set_shared_repository(int value);
 int get_shared_repository(void);
 void reset_shared_repository(void);
 
-/*
- * Do replace refs need to be checked this run?  This variable is
- * initialized to true unless --no-replace-object is used or
- * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
- * commands that do not want replace references to be active.
- */
-extern int read_replace_refs;
-
 /*
  * These values are used to help identify parts of a repository to fsync.
  * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the
diff --git a/config.c b/config.c
index d3ab9417a45..d0aff55fa66 100644
--- a/config.c
+++ b/config.c
@@ -23,6 +23,7 @@
 #include "utf8.h"
 #include "dir.h"
 #include "color.h"
+#include "replace-object.h"
 #include "refs.h"
 #include "worktree.h"
 
diff --git a/environment.c b/environment.c
index 1ee3686fd8a..89d89110e41 100644
--- a/environment.c
+++ b/environment.c
@@ -17,6 +17,7 @@
 #include "commit.h"
 #include "strvec.h"
 #include "object-store.h"
+#include "replace-object.h"
 #include "tmp-objdir.h"
 #include "chdir-notify.h"
 #include "shallow.h"
diff --git a/git.c b/git.c
index 96b0a2837dc..389f46887e6 100644
--- a/git.c
+++ b/git.c
@@ -4,6 +4,7 @@
 #include "help.h"
 #include "run-command.h"
 #include "alias.h"
+#include "replace-object.h"
 #include "shallow.h"
 
 #define RUN_SETUP		(1<<0)
diff --git a/log-tree.c b/log-tree.c
index 1dd5fcbf7be..b1344bd0080 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -12,6 +12,7 @@
 #include "merge-ort.h"
 #include "reflog-walk.h"
 #include "refs.h"
+#include "replace-object.h"
 #include "string-list.h"
 #include "color.h"
 #include "gpg-interface.h"
diff --git a/replace-object.h b/replace-object.h
index 3c92ae94610..500482b02b3 100644
--- a/replace-object.h
+++ b/replace-object.h
@@ -1,11 +1,18 @@
 #ifndef REPLACE_OBJECT_H
 #define REPLACE_OBJECT_H
 
-#include "cache.h"
 #include "oidmap.h"
 #include "repository.h"
 #include "object-store.h"
 
+/*
+ * Do replace refs need to be checked this run?  This variable is
+ * initialized to true unless --no-replace-object is used or
+ * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
+ * commands that do not want replace references to be active.
+ */
+extern int read_replace_refs;
+
 struct replace_object {
 	struct oidmap_entry original;
 	struct object_id replacement;
-- 
gitgitgadget
Previous: Elijah NewrenNext: Elijah Newren via GitGitGadget
Message 34 of 60 in “Header cleanups”
  1. 00/16 Header cleanupsElijah Newren via GitGitGadget, Feb 23, 2023
  2. 01/16 treewide: ensure one of the appropriate headers is sourced firstElijah Newren via GitGitGadget, Feb 23, 2023
  3. 02/16 treewide: remove unnecessary git-compat-util.h includes in headersElijah Newren via GitGitGadget, Feb 23, 2023
  4. Derrick StoleeFeb 23, 2023
  5. Elijah NewrenFeb 23, 2023
  6. Junio C HamanoFeb 23, 2023
  7. Elijah NewrenFeb 23, 2023
  8. Junio C HamanoFeb 23, 2023
  9. Elijah NewrenFeb 23, 2023
  10. 03/16 treewide: remove unnecessary cache.h includesElijah Newren via GitGitGadget, Feb 23, 2023
  11. 04/16 treewide: remove unnecessary cache.h includes in source filesElijah Newren via GitGitGadget, Feb 23, 2023
  12. Derrick StoleeFeb 23, 2023
  13. 06/16 hash.h: move some oid-related declarations from cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  14. Derrick StoleeFeb 23, 2023
  15. Elijah NewrenFeb 23, 2023
  16. Jonathan TanFeb 24, 2023
  17. 05/16 alloc.h: move ALLOC_GROW() functions from cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  18. Derrick StoleeFeb 23, 2023
  19. Elijah NewrenFeb 23, 2023
  20. Junio C HamanoFeb 23, 2023
  21. Junio C HamanoFeb 23, 2023
  22. 07/16 hex.h: move some hex-related declarations from cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  23. Derrick StoleeFeb 23, 2023
  24. Elijah NewrenFeb 23, 2023
  25. 09/16 ident.h: move ident-related declarations out of cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  26. 08/16 pretty.h: move has_non_ascii() declaration from commit.hElijah Newren via GitGitGadget, Feb 23, 2023
  27. 10/16 object.h: stop depending on cache.h; make cache.h depend on object.hElijah Newren via GitGitGadget, Feb 23, 2023
  28. Derrick StoleeFeb 23, 2023
  29. Elijah NewrenFeb 23, 2023
  30. 11/16 dir.h: refactor to no longer need to include cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  31. 12/16 object-store.h: move struct object_info from cache.hElijah Newren via GitGitGadget, Feb 23, 2023
  32. Derrick StoleeFeb 23, 2023
  33. Elijah NewrenFeb 23, 2023
  34. 13/16 replace-object.h: move read_replace_refs declaration from cache.h to hereElijah Newren via GitGitGadget, Feb 23, 2023
  35. 15/16 Remove unnecessary includes of builtin.hElijah Newren via GitGitGadget, Feb 23, 2023
  36. 14/16 treewide: replace cache.h with more direct headers, where possibleElijah Newren via GitGitGadget, Feb 23, 2023
  37. 16/16 diff.h: remove unnecessary include of object.hElijah Newren via GitGitGadget, Feb 23, 2023
  38. Derrick StoleeFeb 23, 2023
  39. 00/17 Header cleanupsElijah Newren via GitGitGadget, Feb 24, 2023
  40. 01/17 treewide: ensure one of the appropriate headers is sourced firstElijah Newren via GitGitGadget, Feb 24, 2023
  41. 02/17 treewide: remove unnecessary git-compat-util.h includes in headersElijah Newren via GitGitGadget, Feb 24, 2023
  42. 03/17 treewide: remove unnecessary cache.h includesElijah Newren via GitGitGadget, Feb 24, 2023
  43. 04/17 treewide: remove unnecessary cache.h includes in source filesElijah Newren via GitGitGadget, Feb 24, 2023
  44. 06/17 hash.h: move some oid-related declarations from cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  45. 07/17 hex.h: move some hex-related declarations from cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  46. 09/17 pretty.h: move has_non_ascii() declaration from commit.hElijah Newren via GitGitGadget, Feb 24, 2023
  47. 05/17 alloc.h: move ALLOC_GROW() functions from cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  48. 10/17 ident.h: move ident-related declarations out of cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  49. 11/17 object.h: stop depending on cache.h; make cache.h depend on object.hElijah Newren via GitGitGadget, Feb 24, 2023
  50. 12/17 dir.h: refactor to no longer need to include cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  51. 13/17 object-store.h: move struct object_info from cache.hElijah Newren via GitGitGadget, Feb 24, 2023
  52. 15/17 treewide: replace cache.h with more direct headers, where possibleElijah Newren via GitGitGadget, Feb 24, 2023
  53. 14/17 replace-object.h: move read_replace_refs declaration from cache.h to hereElijah Newren via GitGitGadget, Feb 24, 2023
  54. 16/17 Remove unnecessary includes of builtin.hElijah Newren via GitGitGadget, Feb 24, 2023
  55. 08/17 cache.h: remove dependence on hex.h; make other files include it explicitlyElijah Newren via GitGitGadget, Feb 24, 2023
  56. 17/17 diff.h: remove unnecessary include of object.hElijah Newren via GitGitGadget, Feb 24, 2023
  57. Johannes SchindelinFeb 24, 2023
  58. Jonathan TanFeb 25, 2023
  59. Elijah NewrenFeb 25, 2023
  60. Derrick StoleeFeb 27, 2023

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.