treewide: be explicit about dependence on trace.h & trace2.h

Dozens of files made use of trace and trace2 functions, without explicitly including trace.h or trace2.h. This made it more difficult to find which files could remove a dependence on cache.h. Make C files explicitly include trace.h or trace2.h if they are using them. Signed-off-by: Elijah Newren <newren@gmail.com> Acked-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Apr 11, 2023 at 03:00 UTC 74ea5c9574d29a510602492fcd672e5d09c841b0
62 files changed +70 -2
blame.c
+1
@@ -9,6 +9,7 @@
9 #include "hex.h"
10 #include "setup.h"
11 #include "tag.h"
12 +#include "trace2.h"
13 #include "blame.h"
14 #include "alloc.h"
15 #include "commit-slab.h"
builtin/checkout.c
+1
@@ -26,6 +26,7 @@
26 #include "setup.h"
27 #include "submodule.h"
28 #include "submodule-config.h"
29 +#include "trace2.h"
30 #include "tree.h"
31 #include "tree-walk.h"
32 #include "unpack-trees.h"
builtin/commit-graph.c
+1
@@ -12,6 +12,7 @@
12 #include "progress.h"
13 #include "replace-object.h"
14 #include "tag.h"
15 +#include "trace2.h"
16
17 #define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
18 N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]")
builtin/fetch.c
+2
@@ -31,6 +31,8 @@
31 #include "promisor-remote.h"
32 #include "commit-graph.h"
33 #include "shallow.h"
34 +#include "trace.h"
35 +#include "trace2.h"
36 #include "worktree.h"
37 #include "bundle-uri.h"
38
builtin/fsmonitor--daemon.c
+1
@@ -14,6 +14,7 @@
14 #include "simple-ipc.h"
15 #include "khash.h"
16 #include "pkt-line.h"
17 +#include "trace2.h"
18
19 static const char * const builtin_fsmonitor__daemon_usage[] = {
20 N_("git fsmonitor--daemon start [<options>]"),
builtin/gc.c
+1
@@ -37,6 +37,7 @@
37 #include "gettext.h"
38 #include "hook.h"
39 #include "setup.h"
40 +#include "trace2.h"
41 #include "wrapper.h"
42
43 #define FAILED_RUN "failed to run %s"
builtin/push.c
+1
@@ -16,6 +16,7 @@
16 #include "submodule.h"
17 #include "submodule-config.h"
18 #include "send-pack.h"
19 +#include "trace2.h"
20 #include "color.h"
21
22 static const char * const push_usage[] = {
builtin/rebase.c
+1
@@ -32,6 +32,7 @@
32 #include "sequencer.h"
33 #include "rebase-interactive.h"
34 #include "reset.h"
35 +#include "trace2.h"
36 #include "hook.h"
37 #include "wrapper.h"
38
builtin/receive-pack.c
+2
@@ -32,6 +32,8 @@
32 #include "object-store.h"
33 #include "protocol.h"
34 #include "commit-reach.h"
35 +#include "trace.h"
36 +#include "trace2.h"
37 #include "worktree.h"
38 #include "shallow.h"
39 #include "wrapper.h"
builtin/reset.c
+2
@@ -29,6 +29,8 @@
29 #include "setup.h"
30 #include "submodule.h"
31 #include "submodule-config.h"
32 +#include "trace.h"
33 +#include "trace2.h"
34 #include "dir.h"
35 #include "add-interactive.h"
36
cache-tree.c
+2
@@ -11,6 +11,8 @@
11 #include "replace-object.h"
12 #include "promisor-remote.h"
13 #include "sparse-index.h"
14 +#include "trace.h"
15 +#include "trace2.h"
16
17 #ifndef DEBUG_CACHE_TREE
18 #define DEBUG_CACHE_TREE 0
cache.h
-2
@@ -8,8 +8,6 @@
8 #include "advice.h"
9 #include "gettext.h"
10 #include "convert.h"
11 -#include "trace.h"
12 -#include "trace2.h"
11 #include "string-list.h"
12 #include "pack-revindex.h"
13 #include "hash.h"
chdir-notify.c
+1
@@ -3,6 +3,7 @@
3 #include "chdir-notify.h"
4 #include "list.h"
5 #include "strbuf.h"
6 +#include "trace.h"
7
8 struct chdir_notify_entry {
9 const char *name;
common-main.c
+1
@@ -3,6 +3,7 @@
3 #include "gettext.h"
4 #include "attr.h"
5 #include "setup.h"
6 +#include "trace2.h"
7
8 /*
9 * Many parts of Git have subprograms communicate via pipe, expect the
compat/fsmonitor/fsm-listen-win32.c
+1
@@ -4,6 +4,7 @@
4 #include "fsm-listen.h"
5 #include "fsmonitor--daemon.h"
6 #include "gettext.h"
7 +#include "trace2.h"
8
9 /*
10 * The documentation of ReadDirectoryChangesW() states that the maximum
compat/mingw.c
+1
@@ -12,6 +12,7 @@
12 #include "win32/lazyload.h"
13 #include "../config.h"
14 #include "../environment.h"
15 +#include "../trace2.h"
16 #include "../wrapper.h"
17 #include "dir.h"
18 #include "gettext.h"
compat/simple-ipc/ipc-unix-socket.c
+1
@@ -4,6 +4,7 @@
4 #include "strbuf.h"
5 #include "pkt-line.h"
6 #include "thread-utils.h"
7 +#include "trace2.h"
8 #include "unix-socket.h"
9 #include "unix-stream-server.h"
10
compat/simple-ipc/ipc-win32.c
+2
@@ -5,6 +5,8 @@
5 #include "strbuf.h"
6 #include "pkt-line.h"
7 #include "thread-utils.h"
8 +#include "trace.h"
9 +#include "trace2.h"
10 #include "accctrl.h"
11 #include "aclapi.h"
12
compat/win32/trace2_win32_process_info.c
+1
@@ -1,5 +1,6 @@
1 #include "../../cache.h"
2 #include "../../json-writer.h"
3 +#include "../../trace2.h"
4 #include "lazyload.h"
5 #include <Psapi.h>
6 #include <tlHelp32.h>
config.c
+1
@@ -28,6 +28,7 @@
28 #include "replace-object.h"
29 #include "refs.h"
30 #include "setup.h"
31 +#include "trace2.h"
32 #include "worktree.h"
33 #include "wrapper.h"
34 #include "write-or-die.h"
connect.c
+1
@@ -14,6 +14,7 @@
14 #include "string-list.h"
15 #include "oid-array.h"
16 #include "transport.h"
17 +#include "trace2.h"
18 #include "strbuf.h"
19 #include "version.h"
20 #include "protocol.h"
convert.c
+1
@@ -9,6 +9,7 @@
9 #include "sigchain.h"
10 #include "pkt-line.h"
11 #include "sub-process.h"
12 +#include "trace.h"
13 #include "utf8.h"
14 #include "ll-merge.h"
15 #include "wrapper.h"
diff-lib.c
+1
@@ -13,6 +13,7 @@
13 #include "unpack-trees.h"
14 #include "refs.h"
15 #include "submodule.h"
16 +#include "trace.h"
17 #include "dir.h"
18 #include "fsmonitor.h"
19 #include "commit-reach.h"
dir.c
+1
@@ -23,6 +23,7 @@
23 #include "fsmonitor.h"
24 #include "setup.h"
25 #include "submodule-config.h"
26 +#include "trace2.h"
27 #include "wrapper.h"
28
29 /*
environment.c
+1
@@ -24,6 +24,7 @@
24 #include "chdir-notify.h"
25 #include "setup.h"
26 #include "shallow.h"
27 +#include "trace.h"
28 #include "wrapper.h"
29 #include "write-or-die.h"
30
exec-cmd.c
+2
@@ -5,6 +5,8 @@
5 #include "gettext.h"
6 #include "quote.h"
7 #include "strvec.h"
8 +#include "trace.h"
9 +#include "trace2.h"
10
11 #if defined(RUNTIME_PREFIX)
12
fetch-pack.c
+1
@@ -17,6 +17,7 @@
17 #include "remote.h"
18 #include "run-command.h"
19 #include "connect.h"
20 +#include "trace2.h"
21 #include "transport.h"
22 #include "version.h"
23 #include "oid-array.h"
fsmonitor.c
+1
@@ -7,6 +7,7 @@
7 #include "fsmonitor-ipc.h"
8 #include "run-command.h"
9 #include "strbuf.h"
10 +#include "trace2.h"
11
12 #define INDEX_EXTENSION_VERSION1 (1)
13 #define INDEX_EXTENSION_VERSION2 (2)
fsmonitor.h
+1
@@ -4,6 +4,7 @@
4 #include "cache.h"
5 #include "dir.h"
6 #include "fsmonitor-settings.h"
7 +#include "trace.h"
8
9 extern struct trace_key trace_fsmonitor;
10
git.c
+2
@@ -9,6 +9,8 @@
9 #include "replace-object.h"
10 #include "setup.h"
11 #include "shallow.h"
12 +#include "trace.h"
13 +#include "trace2.h"
14
15 #define RUN_SETUP (1<<0)
16 #define RUN_SETUP_GENTLY (1<<1)
http.c
+1
@@ -12,6 +12,7 @@
12 #include "version.h"
13 #include "pkt-line.h"
14 #include "gettext.h"
15 +#include "trace.h"
16 #include "transport.h"
17 #include "packfile.h"
18 #include "protocol.h"
merge-ort.c
+1
@@ -37,6 +37,7 @@
37 #include "strmap.h"
38 #include "submodule-config.h"
39 #include "submodule.h"
40 +#include "trace2.h"
41 #include "tree.h"
42 #include "unpack-trees.h"
43 #include "xdiff-interface.h"
name-hash.c
+1
@@ -9,6 +9,7 @@
9 #include "environment.h"
10 #include "gettext.h"
11 #include "thread-utils.h"
12 +#include "trace.h"
13 #include "trace2.h"
14 #include "sparse-index.h"
15
notes-merge.c
+1
@@ -13,6 +13,7 @@
13 #include "notes.h"
14 #include "notes-merge.h"
15 #include "strbuf.h"
16 +#include "trace.h"
17 #include "notes-utils.h"
18 #include "commit-reach.h"
19 #include "wrapper.h"
pack-bitmap.c
+1
@@ -15,6 +15,7 @@
15 #include "pack-objects.h"
16 #include "packfile.h"
17 #include "repository.h"
18 +#include "trace2.h"
19 #include "object-store.h"
20 #include "list-objects-filter-options.h"
21 #include "midx.h"
pack-revindex.c
+1
@@ -3,6 +3,7 @@
3 #include "pack-revindex.h"
4 #include "object-store.h"
5 #include "packfile.h"
6 +#include "trace2.h"
7 #include "config.h"
8 #include "midx.h"
9
packfile.c
+1
@@ -15,6 +15,7 @@
15 #include "commit.h"
16 #include "object.h"
17 #include "tag.h"
18 +#include "trace.h"
19 #include "tree-walk.h"
20 #include "tree.h"
21 #include "object-store.h"
pkt-line.c
+1
@@ -3,6 +3,7 @@
3 #include "gettext.h"
4 #include "hex.h"
5 #include "run-command.h"
6 +#include "trace.h"
7 #include "wrapper.h"
8 #include "write-or-die.h"
9
preload-index.c
+1
@@ -11,6 +11,7 @@
11 #include "progress.h"
12 #include "thread-utils.h"
13 #include "repository.h"
14 +#include "trace2.h"
15
16 /*
17 * Mostly randomly chosen maximum thread counts: we
progress.c
+1
@@ -13,6 +13,7 @@
13 #include "progress.h"
14 #include "strbuf.h"
15 #include "trace.h"
16 +#include "trace2.h"
17 #include "utf8.h"
18 #include "config.h"
19
promisor-remote.c
+1
@@ -4,6 +4,7 @@
4 #include "object-store.h"
5 #include "promisor-remote.h"
6 #include "config.h"
7 +#include "trace2.h"
8 #include "transport.h"
9 #include "strvec.h"
10 #include "packfile.h"
protocol.c
+1
@@ -2,6 +2,7 @@
2 #include "config.h"
3 #include "environment.h"
4 #include "protocol.h"
5 +#include "trace2.h"
6
7 static enum protocol_version parse_protocol_version(const char *value)
8 {
read-cache.c
+1
@@ -23,6 +23,7 @@
23 #include "resolve-undo.h"
24 #include "run-command.h"
25 #include "strbuf.h"
26 +#include "trace2.h"
27 #include "varint.h"
28 #include "split-index.h"
29 #include "utf8.h"
remote-curl.c
+1
@@ -21,6 +21,7 @@
21 #include "setup.h"
22 #include "protocol.h"
23 #include "quote.h"
24 +#include "trace2.h"
25 #include "transport.h"
26 #include "write-or-die.h"
27
repository.c
+1
@@ -14,6 +14,7 @@
14 #include "setup.h"
15 #include "submodule-config.h"
16 #include "sparse-index.h"
17 +#include "trace2.h"
18 #include "promisor-remote.h"
19
20 /* The main repository */
revision.c
+1
@@ -31,6 +31,7 @@
31 #include "worktree.h"
32 #include "setup.h"
33 #include "strvec.h"
34 +#include "trace2.h"
35 #include "commit-reach.h"
36 #include "commit-graph.h"
37 #include "prio-queue.h"
run-command.c
+2
@@ -8,6 +8,8 @@
8 #include "thread-utils.h"
9 #include "strbuf.h"
10 #include "string-list.h"
11 +#include "trace.h"
12 +#include "trace2.h"
13 #include "quote.h"
14 #include "config.h"
15 #include "packfile.h"
scalar.c
+1
@@ -16,6 +16,7 @@
16 #include "packfile.h"
17 #include "help.h"
18 #include "setup.h"
19 +#include "trace2.h"
20
21 static void setup_enlistment_directory(int argc, const char **argv,
22 const char * const *usagestr,
setup.c
+1
@@ -10,6 +10,7 @@
10 #include "chdir-notify.h"
11 #include "promisor-remote.h"
12 #include "quote.h"
13 +#include "trace2.h"
14
15 static int inside_git_dir = -1;
16 static int inside_work_tree = -1;
shallow.c
+1
@@ -17,6 +17,7 @@
17 #include "list-objects.h"
18 #include "commit-reach.h"
19 #include "shallow.h"
20 +#include "trace.h"
21 #include "wrapper.h"
22
23 void set_alternate_shallow_file(struct repository *r, const char *path, int override)
submodule.c
+1
@@ -28,6 +28,7 @@
28 #include "commit-reach.h"
29 #include "setup.h"
30 #include "shallow.h"
31 +#include "trace2.h"
32
33 static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
34 static int initialized_fetch_ref_tips;
t/helper/test-date.c
+1
@@ -1,6 +1,7 @@
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "date.h"
4 +#include "trace.h"
5
6 static const char *usage_msg = "\n"
7 " test-tool date relative [time_t]...\n"
t/helper/test-lazy-init-name-hash.c
+1
@@ -4,6 +4,7 @@
4 #include "environment.h"
5 #include "parse-options.h"
6 #include "setup.h"
7 +#include "trace.h"
8
9 static int single;
10 static int multi;
t/helper/test-path-utils.c
+1
@@ -4,6 +4,7 @@
4 #include "environment.h"
5 #include "setup.h"
6 #include "string-list.h"
7 +#include "trace.h"
8 #include "utf8.h"
9
10 /*
trace.c
+1
@@ -26,6 +26,7 @@
26 #include "environment.h"
27 #include "quote.h"
28 #include "setup.h"
29 +#include "trace.h"
30 #include "wrapper.h"
31
32 struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
trace2.c
+1
@@ -7,6 +7,7 @@
7 #include "thread-utils.h"
8 #include "version.h"
9 #include "trace.h"
10 +#include "trace2.h"
11 #include "trace2/tr2_cfg.h"
12 #include "trace2/tr2_cmd_name.h"
13 #include "trace2/tr2_ctr.h"
transport.c
+1
@@ -22,6 +22,7 @@
22 #include "string-list.h"
23 #include "oid-array.h"
24 #include "sigchain.h"
25 +#include "trace2.h"
26 #include "transport-internal.h"
27 #include "protocol.h"
28 #include "object-store.h"
tree-walk.c
+1
@@ -5,6 +5,7 @@
5 #include "gettext.h"
6 #include "hex.h"
7 #include "object-store.h"
8 +#include "trace2.h"
9 #include "tree.h"
10 #include "pathspec.h"
11 #include "json-writer.h"
unpack-trees.c
+1
@@ -17,6 +17,7 @@
17 #include "sparse-index.h"
18 #include "submodule.h"
19 #include "submodule-config.h"
20 +#include "trace2.h"
21 #include "fsmonitor.h"
22 #include "object-store.h"
23 #include "promisor-remote.h"
upload-pack.c
+1
@@ -22,6 +22,7 @@
22 #include "version.h"
23 #include "string-list.h"
24 #include "strvec.h"
25 +#include "trace2.h"
26 #include "prio-queue.h"
27 #include "protocol.h"
28 #include "quote.h"
wrapper.c
+1
@@ -5,6 +5,7 @@
5 #include "abspath.h"
6 #include "config.h"
7 #include "gettext.h"
8 +#include "trace2.h"
9 #include "wrapper.h"
10
11 static intmax_t count_fsync_writeout_only;
wt-status.c
+2
@@ -18,6 +18,8 @@
18 #include "column.h"
19 #include "setup.h"
20 #include "strbuf.h"
21 +#include "trace.h"
22 +#include "trace2.h"
23 #include "utf8.h"
24 #include "worktree.h"
25 #include "lockfile.h"