git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH 10/16] treewide: remove unnecessary includes of cache.h
Date: Sun, 19 Mar 2023 06:27:56 +0000	[thread overview]
Message-ID: <f4e15c9e5c2e9ee4ed463a93be90c6080aebb8e5.1679207285.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1493.git.1679207282.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

The last several commits were geared at replacing the include of cache.h
in strbuf.c with an include of git-compat-util.h.  Unfortunately, I had
to drop a patch moving some functions from cache.h to object-name.h, due
to excessive conflicts with other in-flight topics.

However, even without that patch, the series of patches so far allows us
to modify a number of C files to replace an include of cache.h with
git-compat-util.h.  Do that to reduce our dependencies.

(If we could have kept our object-name.h patch in this series, it would
have also let us reduce the includes in checkout.c and fmt-merge-msg.c
in addition to strbuf.c).

Just to ensure that nothing else was bringing in cache.h, all of the
affected files have been checked to ensure that
    gcc -E -I. $SOURCE_FILE | grep '"cache.h"'
found no hits and that
    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}
successfully compiles without warnings.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 compat/terminal.c      | 2 +-
 gpg-interface.c        | 2 +-
 lockfile.c             | 2 +-
 parse-options.c        | 1 -
 t/helper/test-delta.c  | 1 -
 t/helper/test-trace2.c | 2 +-
 tempfile.c             | 3 ++-
 trace2/tr2_cfg.c       | 4 +++-
 trace2/tr2_cmd_name.c  | 3 ++-
 trace2/tr2_dst.c       | 3 ++-
 trace2/tr2_sid.c       | 3 ++-
 usage.c                | 3 ++-
 12 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/compat/terminal.c b/compat/terminal.c
index ed2b30b38f7..d87e3211892 100644
--- a/compat/terminal.c
+++ b/compat/terminal.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "compat/terminal.h"
 #include "gettext.h"
 #include "sigchain.h"
diff --git a/gpg-interface.c b/gpg-interface.c
index 6644701fda0..aceeb083367 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "commit.h"
 #include "config.h"
 #include "gettext.h"
diff --git a/lockfile.c b/lockfile.c
index 673c21d17a9..1d5ed016828 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2005, Junio C Hamano
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
 #include "abspath.h"
 #include "gettext.h"
 #include "lockfile.h"
diff --git a/parse-options.c b/parse-options.c
index 99fa0440b5d..8615367c69d 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -1,7 +1,6 @@
 #include "git-compat-util.h"
 #include "parse-options.h"
 #include "abspath.h"
-#include "cache.h"
 #include "config.h"
 #include "commit.h"
 #include "color.h"
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index 6609fcbc12e..e7d134ec251 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -11,7 +11,6 @@
 #include "test-tool.h"
 #include "git-compat-util.h"
 #include "delta.h"
-#include "cache.h"
 #include "wrapper.h"
 
 static const char usage_str[] =
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index f374c21ec32..a476df6c6cb 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -1,9 +1,9 @@
 #include "test-tool.h"
-#include "cache.h"
 #include "strvec.h"
 #include "run-command.h"
 #include "exec-cmd.h"
 #include "config.h"
+#include "trace2.h"
 
 typedef int(fn_unit_test)(int argc, const char **argv);
 
diff --git a/tempfile.c b/tempfile.c
index cdd2cab3bad..50c377134ce 100644
--- a/tempfile.c
+++ b/tempfile.c
@@ -42,7 +42,8 @@
  * file created by its parent.
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
+#include "path.h"
 #include "tempfile.h"
 #include "sigchain.h"
 #include "wrapper.h"
diff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c
index ec9ac1a6efd..78cfc15d52d 100644
--- a/trace2/tr2_cfg.c
+++ b/trace2/tr2_cfg.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
+#include "strbuf.h"
+#include "trace2.h"
 #include "trace2/tr2_cfg.h"
 #include "trace2/tr2_sysenv.h"
 
diff --git a/trace2/tr2_cmd_name.c b/trace2/tr2_cmd_name.c
index dd313204f51..b7b5a869b74 100644
--- a/trace2/tr2_cmd_name.c
+++ b/trace2/tr2_cmd_name.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "trace2/tr2_cmd_name.h"
 
 #define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"
diff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c
index 273260e1f18..5be892cd5cd 100644
--- a/trace2/tr2_dst.c
+++ b/trace2/tr2_dst.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "abspath.h"
 #include "sigchain.h"
+#include "strbuf.h"
 #include "trace2/tr2_dst.h"
 #include "trace2/tr2_sid.h"
 #include "trace2/tr2_sysenv.h"
diff --git a/trace2/tr2_sid.c b/trace2/tr2_sid.c
index 5f1ce6f85cf..09c4ef0d173 100644
--- a/trace2/tr2_sid.c
+++ b/trace2/tr2_sid.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "hex.h"
+#include "strbuf.h"
 #include "trace2/tr2_tbuf.h"
 #include "trace2/tr2_sid.h"
 
diff --git a/usage.c b/usage.c
index b53c99dbe5b..46d99f8bd43 100644
--- a/usage.c
+++ b/usage.c
@@ -3,8 +3,9 @@
  *
  * Copyright (C) Linus Torvalds, 2005
  */
-#include "cache.h"
+#include "git-compat-util.h"
 #include "gettext.h"
+#include "trace2.h"
 #include "wrapper.h"
 
 static void vreportf(const char *prefix, const char *err, va_list params)
-- 
gitgitgadget


  parent reply	other threads:[~2023-03-19  6:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19  6:27 [PATCH 00/16] Header cleanups Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 01/16] treewide: remove unnecessary cache.h inclusion from a few headers Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 02/16] treewide: be explicit about dependence on gettext.h Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 03/16] treewide: remove unnecessary inclusion of gettext.h Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 04/16] treewide: remove unnecessary cache.h inclusion from several sources Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 05/16] environment: move comment_line_char from cache.h Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 06/16] abspath.h: move absolute path functions " Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 07/16] cache.h: remove expand_user_path() Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 08/16] path.h: move function declarations for path.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 09/16] wrapper.h: move declarations for wrapper.c " Elijah Newren via GitGitGadget
2023-03-19  6:27 ` Elijah Newren via GitGitGadget [this message]
2023-03-19  6:27 ` [PATCH 11/16] environment.h: move declarations for environment.c " Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 12/16] treewide: remove cache.h inclusion due to environment.h changes Elijah Newren via GitGitGadget
2023-03-19  6:27 ` [PATCH 13/16] setup.h: move declarations for setup.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19  6:28 ` [PATCH 14/16] treewide: remove cache.h inclusion due to setup.h changes Elijah Newren via GitGitGadget
2023-03-19  6:28 ` [PATCH 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19  6:28 ` [PATCH 16/16] csum-file.h: remove unnecessary inclusion of cache.h Elijah Newren via GitGitGadget
2023-03-20  9:58 ` [PATCH 00/16] Header cleanups Ævar Arnfjörð Bjarmason
2023-03-20 16:18   ` Elijah Newren
2023-03-21  6:25 ` [PATCH v2 " Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 01/16] treewide: remove unnecessary cache.h inclusion from a few headers Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 02/16] treewide: be explicit about dependence on gettext.h Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 03/16] treewide: remove unnecessary inclusion of gettext.h Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 04/16] treewide: remove unnecessary cache.h inclusion from several sources Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 05/16] environment: move comment_line_char from cache.h Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 06/16] abspath.h: move absolute path functions " Elijah Newren via GitGitGadget
2023-03-21  6:25   ` [PATCH v2 07/16] cache.h: remove expand_user_path() Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 08/16] path.h: move function declarations for path.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 09/16] wrapper.h: move declarations for wrapper.c " Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 10/16] treewide: remove unnecessary includes of cache.h Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 11/16] environment.h: move declarations for environment.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 12/16] treewide: remove cache.h inclusion due to environment.h changes Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 13/16] setup.h: move declarations for setup.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 14/16] treewide: remove cache.h inclusion due to setup.h changes Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21  6:26   ` [PATCH v2 16/16] csum-file.h: remove unnecessary inclusion of cache.h Elijah Newren via GitGitGadget
2023-03-21 21:56   ` [PATCH v2 00/16] Header cleanups Jonathan Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4e15c9e5c2e9ee4ed463a93be90c6080aebb8e5.1679207285.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).