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

[PATCH 05/16] environment: move comment_line_char from cache.h

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 19, 2023, 06:27 UTC
Message-ID
<43457e44b4eaac190ddcafaf95cbc5422df82700.1679207284.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1493.git.1679207282.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

This is one step towards making strbuf.c not depend upon cache.h. Additional steps will follow in subsequent commits.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 add-patch.c      | 1 +
 builtin/branch.c | 1 +
 builtin/commit.c | 1 +
 builtin/merge.c  | 1 +
 builtin/tag.c    | 1 +
 cache.h          | 7 -------
 commit.c         | 1 +
 environment.h    | 7 +++++++
 fmt-merge-msg.c  | 1 +
 sequencer.c      | 1 +
 strbuf.c         | 1 +
 trailer.c        | 1 +
 wt-status.c      | 1 +
 13 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/add-patch.c b/add-patch.c
index 7fe6b66d866..780fb30607b 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "add-interactive.h"
 #include "alloc.h"
+#include "environment.h"
 #include "gettext.h"
 #include "strbuf.h"
 #include "run-command.h"
diff --git a/builtin/branch.c b/builtin/branch.c
index a67a8334d5c..56dbee97d20 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -8,6 +8,7 @@
 #include "cache.h"
 #include "config.h"
 #include "color.h"
+#include "environment.h"
 #include "refs.h"
 #include "commit.h"
 #include "builtin.h"
diff --git a/builtin/commit.c b/builtin/commit.c
index 25575435ad7..42bf20f589c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -12,6 +12,7 @@
 #include "cache-tree.h"
 #include "color.h"
 #include "dir.h"
+#include "environment.h"
 #include "builtin.h"
 #include "diff.h"
 #include "diffcore.h"
diff --git a/builtin/merge.c b/builtin/merge.c
index a90ae5d2ddc..2c9da4b23d1 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -10,6 +10,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
diff --git a/builtin/tag.c b/builtin/tag.c
index 4f9047783a5..78b3e44e993 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -9,6 +9,7 @@
 #include "cache.h"
 #include "config.h"
 #include "builtin.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
diff --git a/cache.h b/cache.h
index 0221bc6d5c9..4b4c2e17557 100644
--- a/cache.h
+++ b/cache.h
@@ -956,13 +956,6 @@ extern int sparse_expect_files_outside_of_patterns;
  */
 int use_optional_locks(void);
 
-/*
- * The character that begins a commented line in user-editable file
- * that is subject to stripspace.
- */
-extern char comment_line_char;
-extern int auto_comment_line_char;
-
 enum log_refs_config {
 	LOG_REFS_UNSET = -1,
 	LOG_REFS_NONE = 0,
diff --git a/commit.c b/commit.c
index 3fdfb325117..f88fc5e1a2c 100644
--- a/commit.c
+++ b/commit.c
@@ -2,6 +2,7 @@
 #include "tag.h"
 #include "commit.h"
 #include "commit-graph.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "repository.h"
diff --git a/environment.h b/environment.h
index d438b5c8f3a..a26931556af 100644
--- a/environment.h
+++ b/environment.h
@@ -3,6 +3,13 @@
 
 #include "strvec.h"
 
+/*
+ * The character that begins a commented line in user-editable file
+ * that is subject to stripspace.
+ */
+extern char comment_line_char;
+extern int auto_comment_line_char;
+
 /*
  * Wrapper of getenv() that returns a strdup value. This value is kept
  * in argv to be freed later.
diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index c870cb95b9d..bc4e61c5b1a 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "environment.h"
 #include "refs.h"
 #include "object-store.h"
 #include "diff.h"
diff --git a/sequencer.c b/sequencer.c
index bc7e72d5fef..0fe00b0bcec 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "lockfile.h"
diff --git a/strbuf.c b/strbuf.c
index 15209777d5a..b9cd593b147 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "alloc.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
diff --git a/trailer.c b/trailer.c
index 9eb1b761190..6a5091a3c46 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "environment.h"
 #include "gettext.h"
 #include "string-list.h"
 #include "run-command.h"
diff --git a/wt-status.c b/wt-status.c
index d15f2b0e7e8..106e46480a1 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -4,6 +4,7 @@
 #include "dir.h"
 #include "commit.h"
 #include "diff.h"
+#include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "revision.h"
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Elijah Newren via GitGitGadget
Message 3 of 37 in “Header cleanups”
  1. 00/16 Header cleanupsElijah Newren via GitGitGadget, Mar 19, 2023
  2. 03/16 treewide: remove unnecessary inclusion of gettext.hElijah Newren via GitGitGadget, Mar 19, 2023
  3. 05/16 environment: move comment_line_char from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  4. 01/16 treewide: remove unnecessary cache.h inclusion from a few headersElijah Newren via GitGitGadget, Mar 19, 2023
  5. 04/16 treewide: remove unnecessary cache.h inclusion from several sourcesElijah Newren via GitGitGadget, Mar 19, 2023
  6. 07/16 cache.h: remove expand_user_path()Elijah Newren via GitGitGadget, Mar 19, 2023
  7. 06/16 abspath.h: move absolute path functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  8. 08/16 path.h: move function declarations for path.c functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  9. 02/16 treewide: be explicit about dependence on gettext.hElijah Newren via GitGitGadget, Mar 19, 2023
  10. 10/16 treewide: remove unnecessary includes of cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  11. 12/16 treewide: remove cache.h inclusion due to environment.h changesElijah Newren via GitGitGadget, Mar 19, 2023
  12. 09/16 wrapper.h: move declarations for wrapper.c functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  13. 14/16 treewide: remove cache.h inclusion due to setup.h changesElijah Newren via GitGitGadget, Mar 19, 2023
  14. 15/16 write-or-die.h: move declarations for write-or-die.c functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  15. 16/16 csum-file.h: remove unnecessary inclusion of cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  16. 11/16 environment.h: move declarations for environment.c functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  17. 13/16 setup.h: move declarations for setup.c functions from cache.hElijah Newren via GitGitGadget, Mar 19, 2023
  18. Ævar Arnfjörð BjarmasonMar 20, 2023
  19. Elijah NewrenMar 20, 2023
  20. 00/16 Header cleanupsElijah Newren via GitGitGadget, Mar 21, 2023
  21. 01/16 treewide: remove unnecessary cache.h inclusion from a few headersElijah Newren via GitGitGadget, Mar 21, 2023
  22. 03/16 treewide: remove unnecessary inclusion of gettext.hElijah Newren via GitGitGadget, Mar 21, 2023
  23. 04/16 treewide: remove unnecessary cache.h inclusion from several sourcesElijah Newren via GitGitGadget, Mar 21, 2023
  24. 05/16 environment: move comment_line_char from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  25. 07/16 cache.h: remove expand_user_path()Elijah Newren via GitGitGadget, Mar 21, 2023
  26. 06/16 abspath.h: move absolute path functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  27. 08/16 path.h: move function declarations for path.c functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  28. 10/16 treewide: remove unnecessary includes of cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  29. 12/16 treewide: remove cache.h inclusion due to environment.h changesElijah Newren via GitGitGadget, Mar 21, 2023
  30. 09/16 wrapper.h: move declarations for wrapper.c functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  31. 11/16 environment.h: move declarations for environment.c functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  32. 02/16 treewide: be explicit about dependence on gettext.hElijah Newren via GitGitGadget, Mar 21, 2023
  33. 14/16 treewide: remove cache.h inclusion due to setup.h changesElijah Newren via GitGitGadget, Mar 21, 2023
  34. 15/16 write-or-die.h: move declarations for write-or-die.c functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  35. 16/16 csum-file.h: remove unnecessary inclusion of cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  36. 13/16 setup.h: move declarations for setup.c functions from cache.hElijah Newren via GitGitGadget, Mar 21, 2023
  37. Jonathan TanMar 21, 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.