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

[PATCH v2 19/22] commit.h: reduce unnecessary includes

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 22, 2023, 20:17 UTC
Message-ID
<7479e72ffd612addd9d71118647849d99c5870f8.1682194652.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1517.v2.git.1682194649.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 add-interactive.c    |  1 +
 archive.c            |  2 ++
 bloom.c              |  1 +
 builtin/diff-tree.c  |  1 +
 builtin/diff.c       |  1 +
 builtin/gc.c         |  1 +
 builtin/log.c        |  1 +
 builtin/merge-tree.c |  1 +
 combine-diff.c       |  1 +
 commit-graph.c       |  1 +
 commit.c             |  1 +
 commit.h             | 11 ++++-------
 dir.c                |  1 +
 fetch-pack.c         |  1 +
 fsck.c               |  1 +
 gpg-interface.c      |  1 +
 grep.c               |  1 +
 http-push.c          |  1 +
 log-tree.c           |  1 +
 merge-ort-wrappers.c |  1 +
 merge.c              |  1 +
 notes-cache.c        |  1 +
 notes-utils.c        |  1 +
 object-name.c        |  1 +
 pack-bitmap-write.c  |  1 +
 parse-options-cb.c   |  1 +
 parse-options.c      |  1 +
 read-cache.c         |  1 +
 ref-filter.c         |  1 +
 reflog.c             |  1 +
 refs/debug.c         |  1 +
 refspec.c            |  1 +
 revision.h           |  1 +
 send-pack.c          |  1 +
 wt-status.c          |  1 +
 35 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/add-interactive.c b/add-interactive.c
index 757a9929d41..de877ca0525 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -12,6 +12,7 @@
 #include "dir.h"
 #include "run-command.h"
 #include "prompt.h"
+#include "tree.h"
 
 static void init_color(struct repository *r, struct add_i_state *s,
 		       const char *section_and_slot, char *dst,
diff --git a/archive.c b/archive.c
index ab8966d73a5..6226e16b25e 100644
--- a/archive.c
+++ b/archive.c
@@ -6,10 +6,12 @@
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
+#include "pretty.h"
 #include "setup.h"
 #include "refs.h"
 #include "object-store.h"
 #include "commit.h"
+#include "tree.h"
 #include "tree-walk.h"
 #include "attr.h"
 #include "archive.h"
diff --git a/bloom.c b/bloom.c
index d0730525da5..aef6b5fea2d 100644
--- a/bloom.c
+++ b/bloom.c
@@ -6,6 +6,7 @@
 #include "hashmap.h"
 #include "commit-graph.h"
 #include "commit.h"
+#include "commit-slab.h"
 
 define_commit_slab(bloom_filter_slab, struct bloom_filter);
 
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 385c2d0230c..0b02c62b85e 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -9,6 +9,7 @@
 #include "builtin.h"
 #include "submodule.h"
 #include "repository.h"
+#include "tree.h"
 
 static struct rev_info log_tree_opt;
 
diff --git a/builtin/diff.c b/builtin/diff.c
index 8f386535d61..457dee14457 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -22,6 +22,7 @@
 #include "setup.h"
 #include "submodule.h"
 #include "oid-array.h"
+#include "tree.h"
 
 #define DIFF_NO_INDEX_EXPLICIT 1
 #define DIFF_NO_INDEX_IMPLICIT 2
diff --git a/builtin/gc.c b/builtin/gc.c
index b95154fba16..d11712b1444 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -12,6 +12,7 @@
 
 #include "builtin.h"
 #include "abspath.h"
+#include "date.h"
 #include "environment.h"
 #include "hex.h"
 #include "repository.h"
diff --git a/builtin/log.c b/builtin/log.c
index 95de51921f8..137b84b31ef 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -44,6 +44,7 @@
 #include "commit-reach.h"
 #include "range-diff.h"
 #include "tmp-objdir.h"
+#include "tree.h"
 #include "write-or-die.h"
 
 #define MAIL_DEFAULT_WRAP 72
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 6b9f006ec19..aa8040c2a6a 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -16,6 +16,7 @@
 #include "exec-cmd.h"
 #include "merge-blobs.h"
 #include "quote.h"
+#include "tree.h"
 
 static int line_termination = '\n';
 
diff --git a/combine-diff.c b/combine-diff.c
index f8d61965776..1e3cd7fb170 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -13,6 +13,7 @@
 #include "xdiff/xmacros.h"
 #include "log-tree.h"
 #include "refs.h"
+#include "tree.h"
 #include "userdiff.h"
 #include "oid-array.h"
 #include "revision.h"
diff --git a/commit-graph.c b/commit-graph.c
index 0c4f2266445..6f612f368ba 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -23,6 +23,7 @@
 #include "shallow.h"
 #include "json-writer.h"
 #include "trace2.h"
+#include "tree.h"
 #include "chunk-format.h"
 #include "wrapper.h"
 
diff --git a/commit.c b/commit.c
index 878b4473e4c..10676165a1d 100644
--- a/commit.c
+++ b/commit.c
@@ -26,6 +26,7 @@
 #include "run-command.h"
 #include "setup.h"
 #include "shallow.h"
+#include "tree.h"
 #include "hook.h"
 
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
diff --git a/commit.h b/commit.h
index 69b2f376e9d..28928833c54 100644
--- a/commit.h
+++ b/commit.h
@@ -2,13 +2,10 @@
 #define COMMIT_H
 
 #include "object.h"
-#include "tree.h"
-#include "strbuf.h"
-#include "decorate.h"
-#include "gpg-interface.h"
-#include "string-list.h"
-#include "pretty.h"
-#include "commit-slab.h"
+
+struct signature_check;
+struct strbuf;
+struct tree;
 
 #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF
 #define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1)
diff --git a/dir.c b/dir.c
index ed262fa6e43..a7469df3ac7 100644
--- a/dir.c
+++ b/dir.c
@@ -27,6 +27,7 @@
 #include "submodule-config.h"
 #include "symlinks.h"
 #include "trace2.h"
+#include "tree.h"
 #include "wrapper.h"
 
 /*
diff --git a/fetch-pack.c b/fetch-pack.c
index 677102465a1..a9745bd9faf 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "repository.h"
 #include "config.h"
+#include "date.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
diff --git a/fsck.c b/fsck.c
index adbe8bf59e7..3261ef9ec28 100644
--- a/fsck.c
+++ b/fsck.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "date.h"
 #include "hex.h"
 #include "object-store.h"
 #include "repository.h"
diff --git a/gpg-interface.c b/gpg-interface.c
index 8615dcd4b4b..49d72c2066b 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "commit.h"
 #include "config.h"
+#include "date.h"
 #include "gettext.h"
 #include "run-command.h"
 #include "strbuf.h"
diff --git a/grep.c b/grep.c
index d144b374894..e620e375b1d 100644
--- a/grep.c
+++ b/grep.c
@@ -4,6 +4,7 @@
 #include "grep.h"
 #include "hex.h"
 #include "object-store.h"
+#include "pretty.h"
 #include "userdiff.h"
 #include "xdiff-interface.h"
 #include "diff.h"
diff --git a/http-push.c b/http-push.c
index 637a4e91f7a..3f184986362 100644
--- a/http-push.c
+++ b/http-push.c
@@ -15,6 +15,7 @@
 #include "setup.h"
 #include "sigchain.h"
 #include "strvec.h"
+#include "tree.h"
 #include "packfile.h"
 #include "object-store.h"
 #include "commit-reach.h"
diff --git a/log-tree.c b/log-tree.c
index b5cf3d8439c..8861900b592 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -24,6 +24,7 @@
 #include "help.h"
 #include "range-diff.h"
 #include "strmap.h"
+#include "tree.h"
 #include "write-or-die.h"
 
 static struct decoration name_decoration = { "object names" };
diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c
index 2c47c5a6237..a5507533009 100644
--- a/merge-ort-wrappers.c
+++ b/merge-ort-wrappers.c
@@ -3,6 +3,7 @@
 #include "hash.h"
 #include "merge-ort.h"
 #include "merge-ort-wrappers.h"
+#include "tree.h"
 
 #include "commit.h"
 
diff --git a/merge.c b/merge.c
index da7fa652c27..10aaec3a6c1 100644
--- a/merge.c
+++ b/merge.c
@@ -7,6 +7,7 @@
 #include "commit.h"
 #include "run-command.h"
 #include "resolve-undo.h"
+#include "tree.h"
 #include "tree-walk.h"
 #include "unpack-trees.h"
 #include "dir.h"
diff --git a/notes-cache.c b/notes-cache.c
index fbcdfd0dfe5..14288caf98f 100644
--- a/notes-cache.c
+++ b/notes-cache.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "notes-cache.h"
 #include "object-store.h"
+#include "pretty.h"
 #include "repository.h"
 #include "commit.h"
 #include "refs.h"
diff --git a/notes-utils.c b/notes-utils.c
index cb88171b7bb..4a793eb347f 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -6,6 +6,7 @@
 #include "refs.h"
 #include "notes-utils.h"
 #include "repository.h"
+#include "strbuf.h"
 
 void create_notes_commit(struct repository *r,
 			 struct notes_tree *t,
diff --git a/object-name.c b/object-name.c
index 3cd5b327293..5ccbe854b60 100644
--- a/object-name.c
+++ b/object-name.c
@@ -15,6 +15,7 @@
 #include "dir.h"
 #include "oid-array.h"
 #include "packfile.h"
+#include "pretty.h"
 #include "object-store.h"
 #include "repository.h"
 #include "setup.h"
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index faf67c94d37..3d3fd380654 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -18,6 +18,7 @@
 #include "commit-reach.h"
 #include "prio-queue.h"
 #include "trace2.h"
+#include "tree.h"
 
 struct bitmapped_commit {
 	struct commit *commit;
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 26a4c7d08a9..be81158f861 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -3,6 +3,7 @@
 #include "branch.h"
 #include "commit.h"
 #include "color.h"
+#include "date.h"
 #include "environment.h"
 #include "gettext.h"
 #include "object-name.h"
diff --git a/parse-options.c b/parse-options.c
index b6803647d0e..f8a155ee13b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -5,6 +5,7 @@
 #include "commit.h"
 #include "color.h"
 #include "gettext.h"
+#include "strbuf.h"
 #include "utf8.h"
 
 static int disallow_abbreviated_options;
diff --git a/read-cache.c b/read-cache.c
index b3e2917ddc9..d64d93bc364 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "date.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "hex.h"
diff --git a/ref-filter.c b/ref-filter.c
index 594e66ad361..84eee904ba3 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "environment.h"
 #include "gettext.h"
+#include "gpg-interface.h"
 #include "hex.h"
 #include "parse-options.h"
 #include "refs.h"
diff --git a/reflog.c b/reflog.c
index 9c094430884..57dc7c0d051 100644
--- a/reflog.c
+++ b/reflog.c
@@ -4,6 +4,7 @@
 #include "reflog.h"
 #include "refs.h"
 #include "revision.h"
+#include "tree.h"
 #include "worktree.h"
 
 /* Remember to update object flag allocation in object.h */
diff --git a/refs/debug.c b/refs/debug.c
index adc34c836fc..6f11e6de46c 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "hex.h"
 #include "refs-internal.h"
+#include "string-list.h"
 #include "trace.h"
 
 static struct trace_key trace_refs = TRACE_KEY_INIT(REFS);
diff --git a/refspec.c b/refspec.c
index 31b61d782c7..57f6c2aaf9b 100644
--- a/refspec.c
+++ b/refspec.c
@@ -6,6 +6,7 @@
 #include "strvec.h"
 #include "refs.h"
 #include "refspec.h"
+#include "strbuf.h"
 
 static struct refspec_item s_tag_refspec = {
 	.force = 0,
diff --git a/revision.h b/revision.h
index 742700504a7..6630bb2eae2 100644
--- a/revision.h
+++ b/revision.h
@@ -8,6 +8,7 @@
 #include "pretty.h"
 #include "diff.h"
 #include "commit-slab-decl.h"
+#include "decorate.h"
 #include "ident.h"
 #include "list-objects-filter-options.h"
 
diff --git a/send-pack.c b/send-pack.c
index 351037b07bc..e68da24cc52 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "config.h"
 #include "commit.h"
+#include "date.h"
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
diff --git a/wt-status.c b/wt-status.c
index 97b9c1c0359..068b76ef6d9 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -22,6 +22,7 @@
 #include "strbuf.h"
 #include "trace.h"
 #include "trace2.h"
+#include "tree.h"
 #include "utf8.h"
 #include "worktree.h"
 #include "lockfile.h"
-- 
gitgitgadget
Previous: Elijah NewrenNext: Ævar Arnfjörð Bjarmason
Message 72 of 81 in “Header cleanups (more splitting of cache.h and simplifying a few other deps)”
  1. 00/23 Header cleanups (more splitting of cache.h and simplifying a few other deps)Elijah Newren via GitGitGadget, Apr 16, 2023
  2. 06/23 copy.h: move declarations for copy.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  3. 03/23 protocol.h: move definition of DEFAULT_GIT_PORT from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  4. 02/23 symlinks.h: move declarations for symlinks.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  5. 01/23 treewide: be explicit about dependence on strbuf.hElijah Newren via GitGitGadget, Apr 16, 2023
  6. 04/23 packfile.h: move pack_window and pack_entry from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  7. 05/23 server-info.h: move declarations for server-info.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  8. 07/23 base85.h: move declarations for base85.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  9. 08/23 pkt-line.h: move declarations for pkt-line.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  10. 09/23 match-trees.h: move declarations for match-trees.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  11. 11/23 versioncmp.h: move declarations for versioncmp.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  12. 10/23 ws.h: move declarations for ws.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  13. 12/23 dir.h: move DTYPE defines from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  14. 15/23 cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.cElijah Newren via GitGitGadget, Apr 16, 2023
  15. 16/23 cache,tree: move basic name compare functions from read-cache to treeElijah Newren via GitGitGadget, Apr 16, 2023
  16. 18/23 cache.h: remove unnecessary headersElijah Newren via GitGitGadget, Apr 16, 2023
  17. 13/23 tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  18. 19/23 fsmonitor: reduce includes of cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  19. 17/23 treewide: remove cache.h inclusion due to previous changesElijah Newren via GitGitGadget, Apr 16, 2023
  20. 14/23 hash.h, repository.h: reverse the order of these dependenciesElijah Newren via GitGitGadget, Apr 16, 2023
  21. Derrick StoleeApr 17, 2023
  22. Elijah NewrenApr 18, 2023
  23. Junio C HamanoApr 18, 2023
  24. Elijah NewrenApr 20, 2023
  25. Derrick StoleeApr 20, 2023
  26. Junio C HamanoApr 20, 2023
  27. Glen ChooApr 20, 2023
  28. 21/23 object-store.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  29. 20/23 commit.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  30. 22/23 diff.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  31. 23/23 reftable: ensure git-compat-util.h is the first (indirect) includeElijah Newren via GitGitGadget, Apr 16, 2023
  32. Derrick StoleeApr 17, 2023
  33. Elijah NewrenApr 18, 2023
  34. 00/22 Header cleanups (more splitting of cache.h and simplifying a few other deps)Elijah Newren via GitGitGadget, Apr 22, 2023
  35. 01/22 treewide: be explicit about dependence on strbuf.hElijah Newren via GitGitGadget, Apr 22, 2023
  36. 02/22 symlinks.h: move declarations for symlinks.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  37. 03/22 packfile.h: move pack_window and pack_entry from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  38. 07/22 pkt-line.h: move declarations for pkt-line.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  39. 04/22 server-info.h: move declarations for server-info.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  40. 05/22 copy.h: move declarations for copy.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  41. 08/22 match-trees.h: move declarations for match-trees.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  42. 06/22 base85.h: move declarations for base85.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  43. 09/22 ws.h: move declarations for ws.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  44. 10/22 versioncmp.h: move declarations for versioncmp.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  45. 11/22 dir.h: move DTYPE defines from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  46. 14/22 cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.cElijah Newren via GitGitGadget, Apr 22, 2023
  47. 15/22 cache,tree: move basic name compare functions from read-cache to treeElijah Newren via GitGitGadget, Apr 22, 2023
  48. 12/22 tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  49. Ævar Arnfjörð BjarmasonMay 1, 2023
  50. Junio C HamanoMay 1, 2023
  51. Elijah NewrenMay 2, 2023
  52. Elijah NewrenMay 2, 2023
  53. Junio C HamanoMay 2, 2023
  54. Elijah NewrenMay 2, 2023
  55. 16/22 treewide: remove cache.h inclusion due to previous changesElijah Newren via GitGitGadget, Apr 22, 2023
  56. Ævar Arnfjörð BjarmasonMay 1, 2023
  57. Elijah NewrenMay 2, 2023
  58. 17/22 cache.h: remove unnecessary headersElijah Newren via GitGitGadget, Apr 22, 2023
  59. Ævar Arnfjörð BjarmasonMay 1, 2023
  60. Elijah NewrenMay 2, 2023
  61. 18/22 fsmonitor: reduce includes of cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  62. 20/22 object-store.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  63. Ævar Arnfjörð BjarmasonMay 1, 2023
  64. Elijah NewrenMay 2, 2023
  65. 13/22 hash-ll.h: split out of hash.h to remove dependency on repository.hElijah Newren via GitGitGadget, Apr 22, 2023
  66. Glen ChooApr 24, 2023
  67. Elijah NewrenApr 26, 2023
  68. Glen ChooApr 26, 2023
  69. Junio C HamanoApr 24, 2023
  70. Ævar Arnfjörð BjarmasonMay 1, 2023
  71. Elijah NewrenMay 2, 2023
  72. 19/22 commit.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  73. Ævar Arnfjörð BjarmasonMay 1, 2023
  74. Elijah NewrenMay 2, 2023
  75. 22/22 reftable: ensure git-compat-util.h is the first (indirect) includeElijah Newren via GitGitGadget, Apr 22, 2023
  76. 21/22 diff.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  77. Ævar Arnfjörð BjarmasonMay 1, 2023
  78. Derrick StoleeApr 24, 2023
  79. Junio C HamanoApr 24, 2023
  80. Glen ChooApr 26, 2023
  81. Junio C HamanoApr 26, 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.