From eea0e59ffbed6e33d171ace5be13cde9faa41639 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 23 Dec 2023 17:14:50 +0000 Subject: treewide: remove unnecessary includes in source files Each of these were checked with gcc -E -I. ${SOURCE_FILE} | grep ${HEADER_FILE} to ensure that removing the direct inclusion of the header actually resulted in that header no longer being included at all (i.e. that no other header pulled it in transitively). ...except for a few cases where we verified that although the header was brought in transitively, nothing from it was directly used in that source file. These cases were: * builtin/credential-cache.c * builtin/pull.c * builtin/send-pack.c Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- commit-graph.c | 1 - 1 file changed, 1 deletion(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index ee66098e07..5bfee53e87 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -8,7 +8,6 @@ #include "commit.h" #include "object.h" #include "refs.h" -#include "revision.h" #include "hash-lookup.h" #include "commit-graph.h" #include "object-file.h" -- cgit v1.2.3 From ec2101abf3ea00a3cbb4c88c14d6658fa6d09984 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 23 Dec 2023 17:14:59 +0000 Subject: treewide: add direct includes currently only pulled in transitively The next commit will remove a bunch of unnecessary includes, but to do so, we need some of the lower level direct includes that files rely on to be explicitly specified. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- builtin/commit-graph.c | 1 + builtin/for-each-ref.c | 1 + builtin/fsmonitor--daemon.c | 1 + commit-graph.c | 1 + 4 files changed, 4 insertions(+) (limited to 'commit-graph.c') diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index c5684342ec..81a28c6fcd 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -11,6 +11,7 @@ #include "object-store-ll.h" #include "progress.h" #include "replace-object.h" +#include "strbuf.h" #include "tag.h" #include "trace2.h" diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 6235d72f9d..b5bc700d13 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "commit.h" #include "config.h" #include "gettext.h" #include "object.h" diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index 7260604534..9f80b9eaff 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -12,6 +12,7 @@ #include "compat/fsmonitor/fsm-health.h" #include "compat/fsmonitor/fsm-listen.h" #include "fsmonitor--daemon.h" +#include "repository.h" #include "simple-ipc.h" #include "khash.h" #include "pkt-line.h" diff --git a/commit-graph.c b/commit-graph.c index 5bfee53e87..e7212400da 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "csum-file.h" #include "gettext.h" #include "hex.h" #include "lockfile.h" -- cgit v1.2.3 From d57c671a511d885a5cd390e3d6064c37af524a91 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 23 Dec 2023 17:15:00 +0000 Subject: treewide: remove unnecessary includes in source files Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- builtin/archive.c | 1 - builtin/commit-graph.c | 1 - builtin/fsck.c | 1 - builtin/fsmonitor--daemon.c | 2 -- builtin/grep.c | 1 - builtin/mktag.c | 1 - builtin/rev-list.c | 1 - builtin/send-pack.c | 1 - commit-graph.c | 1 - compat/simple-ipc/ipc-shared.c | 3 --- compat/simple-ipc/ipc-unix-socket.c | 1 - fsmonitor-ipc.c | 1 - http.c | 1 - line-log.c | 1 - merge-ort.c | 1 - notes-utils.c | 1 - ref-filter.c | 1 - remote-curl.c | 1 - repo-settings.c | 1 - t/helper/test-repository.c | 1 - trace2/tr2_ctr.c | 1 - trace2/tr2_tmr.c | 1 - 22 files changed, 25 deletions(-) (limited to 'commit-graph.c') diff --git a/builtin/archive.c b/builtin/archive.c index 90761fdfee..15ee1ec7bb 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -9,7 +9,6 @@ #include "parse-options.h" #include "pkt-line.h" #include "repository.h" -#include "sideband.h" static void create_output_file(const char *output_file) { diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 81a28c6fcd..666ad574a4 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -4,7 +4,6 @@ #include "environment.h" #include "gettext.h" #include "hex.h" -#include "lockfile.h" #include "parse-options.h" #include "repository.h" #include "commit-graph.h" diff --git a/builtin/fsck.c b/builtin/fsck.c index 9317b7b841..a7cf94f67e 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -10,7 +10,6 @@ #include "refs.h" #include "pack.h" #include "cache-tree.h" -#include "tree-walk.h" #include "fsck.h" #include "parse-options.h" #include "progress.h" diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index 9f80b9eaff..1593713f4c 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -7,7 +7,6 @@ #include "parse-options.h" #include "fsmonitor-ll.h" #include "fsmonitor-ipc.h" -#include "fsmonitor-path-utils.h" #include "fsmonitor-settings.h" #include "compat/fsmonitor/fsm-health.h" #include "compat/fsmonitor/fsm-listen.h" @@ -15,7 +14,6 @@ #include "repository.h" #include "simple-ipc.h" #include "khash.h" -#include "pkt-line.h" #include "run-command.h" #include "trace.h" #include "trace2.h" diff --git a/builtin/grep.c b/builtin/grep.c index f076cc705b..c8e33f9775 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -14,7 +14,6 @@ #include "parse-options.h" #include "string-list.h" #include "run-command.h" -#include "userdiff.h" #include "grep.h" #include "quote.h" #include "dir.h" diff --git a/builtin/mktag.c b/builtin/mktag.c index d8e0b5afc0..4767f1a97e 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -3,7 +3,6 @@ #include "hex.h" #include "parse-options.h" #include "strbuf.h" -#include "tag.h" #include "replace-object.h" #include "object-file.h" #include "object-store-ll.h" diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 460ba7cbaa..b3f4783858 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -12,7 +12,6 @@ #include "object-name.h" #include "object-file.h" #include "object-store-ll.h" -#include "pack.h" #include "pack-bitmap.h" #include "log-tree.h" #include "graph.h" diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 395f2e490d..0b839f583a 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -2,7 +2,6 @@ #include "config.h" #include "hex.h" #include "pkt-line.h" -#include "sideband.h" #include "run-command.h" #include "remote.h" #include "connect.h" diff --git a/commit-graph.c b/commit-graph.c index e7212400da..15980cf949 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -4,7 +4,6 @@ #include "gettext.h" #include "hex.h" #include "lockfile.h" -#include "pack.h" #include "packfile.h" #include "commit.h" #include "object.h" diff --git a/compat/simple-ipc/ipc-shared.c b/compat/simple-ipc/ipc-shared.c index e5e1dda8cc..cb176d966f 100644 --- a/compat/simple-ipc/ipc-shared.c +++ b/compat/simple-ipc/ipc-shared.c @@ -1,8 +1,5 @@ #include "git-compat-util.h" #include "simple-ipc.h" -#include "strbuf.h" -#include "pkt-line.h" -#include "thread-utils.h" #ifndef SUPPORTS_SIMPLE_IPC /* diff --git a/compat/simple-ipc/ipc-unix-socket.c b/compat/simple-ipc/ipc-unix-socket.c index b2f4f22ce4..9b3f2cdf8c 100644 --- a/compat/simple-ipc/ipc-unix-socket.c +++ b/compat/simple-ipc/ipc-unix-socket.c @@ -2,7 +2,6 @@ #include "gettext.h" #include "simple-ipc.h" #include "strbuf.h" -#include "pkt-line.h" #include "thread-utils.h" #include "trace2.h" #include "unix-socket.h" diff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c index 153918cf76..45471b5b74 100644 --- a/fsmonitor-ipc.c +++ b/fsmonitor-ipc.c @@ -1,5 +1,4 @@ #include "git-compat-util.h" -#include "fsmonitor-ll.h" #include "gettext.h" #include "simple-ipc.h" #include "fsmonitor-ipc.h" diff --git a/http.c b/http.c index a64005ceb8..3565c4ec61 100644 --- a/http.c +++ b/http.c @@ -4,7 +4,6 @@ #include "http.h" #include "config.h" #include "pack.h" -#include "sideband.h" #include "run-command.h" #include "url.h" #include "urlmatch.h" diff --git a/line-log.c b/line-log.c index c276ccec54..8ff6ccb772 100644 --- a/line-log.c +++ b/line-log.c @@ -12,7 +12,6 @@ #include "xdiff-interface.h" #include "strbuf.h" #include "log-tree.h" -#include "userdiff.h" #include "line-log.h" #include "setup.h" #include "strvec.h" diff --git a/merge-ort.c b/merge-ort.c index 2a0be46850..77ba7f3020 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -41,7 +41,6 @@ #include "revision.h" #include "sparse-index.h" #include "strmap.h" -#include "submodule.h" #include "trace2.h" #include "tree.h" #include "unpack-trees.h" diff --git a/notes-utils.c b/notes-utils.c index 97c031c26e..08e5dbc607 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -5,7 +5,6 @@ #include "gettext.h" #include "refs.h" #include "notes-utils.h" -#include "repository.h" #include "strbuf.h" void create_notes_commit(struct repository *r, diff --git a/ref-filter.c b/ref-filter.c index 96959a3762..01b90e325c 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -29,7 +29,6 @@ #include "commit-reach.h" #include "worktree.h" #include "hashmap.h" -#include "strvec.h" static struct ref_msg { const char *gone; diff --git a/remote-curl.c b/remote-curl.c index 55eefa70f9..7f81bf3faf 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -11,7 +11,6 @@ #include "run-command.h" #include "pkt-line.h" #include "string-list.h" -#include "sideband.h" #include "strvec.h" #include "credential.h" #include "oid-array.h" diff --git a/repo-settings.c b/repo-settings.c index 525f69c0c7..30cd478762 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -2,7 +2,6 @@ #include "config.h" #include "repository.h" #include "midx.h" -#include "compat/fsmonitor/fsm-listen.h" static void repo_cfg_bool(struct repository *r, const char *key, int *dest, int def) diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c index c925655c64..0c7c5aa4dd 100644 --- a/t/helper/test-repository.c +++ b/t/helper/test-repository.c @@ -3,7 +3,6 @@ #include "commit.h" #include "environment.h" #include "hex.h" -#include "object-store-ll.h" #include "object.h" #include "repository.h" #include "setup.h" diff --git a/trace2/tr2_ctr.c b/trace2/tr2_ctr.c index 87cf9034fb..d3a33715c1 100644 --- a/trace2/tr2_ctr.c +++ b/trace2/tr2_ctr.c @@ -1,5 +1,4 @@ #include "git-compat-util.h" -#include "thread-utils.h" #include "trace2/tr2_tgt.h" #include "trace2/tr2_tls.h" #include "trace2/tr2_ctr.h" diff --git a/trace2/tr2_tmr.c b/trace2/tr2_tmr.c index 31d0e4d1bd..51f564b07a 100644 --- a/trace2/tr2_tmr.c +++ b/trace2/tr2_tmr.c @@ -1,5 +1,4 @@ #include "git-compat-util.h" -#include "thread-utils.h" #include "trace2/tr2_tgt.h" #include "trace2/tr2_tls.h" #include "trace2/tr2_tmr.h" -- cgit v1.2.3