Subject: [PATCH v2 15/17] treewide: replace cache.h with more direct headers, where possible

From: "Elijah Newren via GitGitGadget" <[email-masked]>
Date: Fri, 24 Feb 2023 00:09:34 +0000

From: Elijah Newren <[email-masked]>

Signed-off-by: Elijah Newren <[email-masked]>
---
 advice.c          | 4 +++-
 decorate.c        | 3 ++-
 diffcore-order.c  | 3 ++-
 diffcore-rename.c | 6 +++++-
 diffcore-rotate.c | 3 ++-
 graph.c           | 3 ++-
 hook.c            | 5 ++++-
 quote.c           | 1 +
 sha1dc_git.c      | 3 ++-
 unix-socket.c     | 3 ++-
 url.c             | 3 ++-
 urlmatch.c        | 4 +++-
 12 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/advice.c b/advice.c
index fd189689437..a5ea460ab86 100644
--- a/advice.c
+++ b/advice.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
 #include "config.h"
 #include "color.h"
+#include "gettext.h"
 #include "help.h"
 #include "string-list.h"
 
diff --git a/decorate.c b/decorate.c
index 2036d159671..71e79daa825 100644
--- a/decorate.c
+++ b/decorate.c
@@ -2,7 +2,8 @@
  * decorate.c - decorate a git object with some arbitrary
  * data.
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hashmap.h"
 #include "object.h"
 #include "decorate.h"
 
diff --git a/diffcore-order.c b/diffcore-order.c
index 19e73311f9c..57ccab28464 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -1,7 +1,8 @@
 /*
  * Copyright (C) 2005 Junio C Hamano
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
 #include "diff.h"
 #include "diffcore.h"
 
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 62c0299984e..7e9ff96d435 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -2,15 +2,19 @@
  *
  * Copyright (C) 2005 Junio C Hamano
  */
-#include "cache.h"
+#include "git-compat-util.h"
 #include "alloc.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "object-store.h"
 #include "hashmap.h"
+#include "mem-pool.h"
+#include "oid-array.h"
 #include "progress.h"
 #include "promisor-remote.h"
+#include "string-list.h"
 #include "strmap.h"
+#include "trace2.h"
 
 /* Table of rename/copy destinations */
 
diff --git a/diffcore-rotate.c b/diffcore-rotate.c
index 445f060ab00..533986cf632 100644
--- a/diffcore-rotate.c
+++ b/diffcore-rotate.c
@@ -2,7 +2,8 @@
  * Copyright (C) 2021, Google LLC.
  * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
 #include "diff.h"
 #include "diffcore.h"
 
diff --git a/graph.c b/graph.c
index 568b6e7cd41..2a9dc430fae 100644
--- a/graph.c
+++ b/graph.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
 #include "config.h"
 #include "commit.h"
 #include "color.h"
diff --git a/hook.c b/hook.c
index 1a848318634..f6ddd790988 100644
--- a/hook.c
+++ b/hook.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
+#include "gettext.h"
 #include "hook.h"
 #include "run-command.h"
 #include "config.h"
+#include "strbuf.h"
 
 const char *find_hook(const char *name)
 {
diff --git a/quote.c b/quote.c
index 2453397fbbd..7ccb5a06cd1 100644
--- a/quote.c
+++ b/quote.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "quote.h"
+#include "strbuf.h"
 #include "strvec.h"
 
 int quote_path_fully = 1;
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 72709606fdf..9b675a046ee 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "sha1dc_git.h"
 #include "hex.h"
 
 #ifdef DC_SHA1_EXTERNAL
diff --git a/unix-socket.c b/unix-socket.c
index e0be1badb58..79800d80636 100644
--- a/unix-socket.c
+++ b/unix-socket.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "unix-socket.h"
 
 #define DEFAULT_UNIX_STREAM_LISTEN_BACKLOG (5)
diff --git a/url.c b/url.c
index bf318c05205..2e1a9f6feec 100644
--- a/url.c
+++ b/url.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "hex.h"
+#include "strbuf.h"
 #include "url.h"
 
 int is_urlschemechar(int first_flag, int ch)
diff --git a/urlmatch.c b/urlmatch.c
index 2965cbe774f..eba0bdd77fe 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
 #include "hex.h"
+#include "strbuf.h"
 #include "urlmatch.h"
 
 #define URL_ALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-- 
gitgitgadget