]> git.ipfire.org Git - thirdparty/git.git/commitdiff
treewide: remove unnecessary includes of cache.h
authorElijah Newren <newren@gmail.com>
Tue, 21 Mar 2023 06:26:02 +0000 (06:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Mar 2023 17:56:53 +0000 (10:56 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 files changed:
compat/terminal.c
gpg-interface.c
lockfile.c
parse-options.c
t/helper/test-delta.c
t/helper/test-trace2.c
tempfile.c
trace2/tr2_cfg.c
trace2/tr2_cmd_name.c
trace2/tr2_dst.c
trace2/tr2_sid.c
usage.c

index ed2b30b38f7c18281d153b4732a8365cb5019513..d87e32118929742db0373fe71502bc969426c09e 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "compat/terminal.h"
 #include "gettext.h"
 #include "sigchain.h"
index 6644701fda05ad61327791a328e645c177d16fee..aceeb083367bd5c147e809ac8f0f4c2e155622e6 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "commit.h"
 #include "config.h"
 #include "gettext.h"
index 673c21d17a98a166a0cfc9107f115327f043a723..1d5ed0168287464e24d60e30b0cfbce181676535 100644 (file)
@@ -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"
index a577cc85f67ed3b986be9b7ef4bc543cde023a67..b6803647d0eb84c6e4cdbbb3c053b8c082c0829c 100644 (file)
@@ -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"
index 6609fcbc12e7f507f9a26399d49b76372bd81f2e..e7d134ec251e01405a6f854bbd496d797980172f 100644 (file)
@@ -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[] =
index f374c21ec32ecc049bace6821d5630e103b8937c..a476df6c6cb223aabd9ed09887779569d3d29a3e 100644 (file)
@@ -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);
 
index cdd2cab3bada725e7276665ace87a2d7cab353db..50c377134ce602c3a9f8ed1ec6344bd4da7eb18f 100644 (file)
@@ -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"
index ec9ac1a6efd3f62b4ccae9db8a9d3ac3ceb1c64a..78cfc15d52dd5800ea5bd610e5db7b0e73b4f8af 100644 (file)
@@ -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"
 
index dd313204f517183ccde962e84b6d4be611adb280..b7b5a869b74bcd02c4157d87212359c7dc47e668 100644 (file)
@@ -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"
index 273260e1f1804044c7846f134e2ee22883aa4104..5be892cd5cdefa654cfd538ea562c2656d23182e 100644 (file)
@@ -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"
index 5f1ce6f85cf9cd748517f94f02ab47976febf50d..09c4ef0d17378748ee67a870301f7b086bcf6163 100644 (file)
@@ -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 b53c99dbe5bdc5803dcfe7cc6fabff88025fbe42..46d99f8bd43a2456bf59337fab2101463c66b54b 100644 (file)
--- 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)