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>
This commit is contained in:
Elijah Newren 2023-04-11 03:00:38 +00:00 committed by Junio C Hamano
parent e7dca80692
commit 74ea5c9574
62 changed files with 70 additions and 2 deletions

View File

@ -9,6 +9,7 @@
#include "hex.h" #include "hex.h"
#include "setup.h" #include "setup.h"
#include "tag.h" #include "tag.h"
#include "trace2.h"
#include "blame.h" #include "blame.h"
#include "alloc.h" #include "alloc.h"
#include "commit-slab.h" #include "commit-slab.h"

View File

@ -26,6 +26,7 @@
#include "setup.h" #include "setup.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace2.h"
#include "tree.h" #include "tree.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "unpack-trees.h" #include "unpack-trees.h"

View File

@ -12,6 +12,7 @@
#include "progress.h" #include "progress.h"
#include "replace-object.h" #include "replace-object.h"
#include "tag.h" #include "tag.h"
#include "trace2.h"
#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \ #define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]") N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]")

View File

@ -31,6 +31,8 @@
#include "promisor-remote.h" #include "promisor-remote.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "shallow.h" #include "shallow.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "bundle-uri.h" #include "bundle-uri.h"

View File

@ -14,6 +14,7 @@
#include "simple-ipc.h" #include "simple-ipc.h"
#include "khash.h" #include "khash.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "trace2.h"
static const char * const builtin_fsmonitor__daemon_usage[] = { static const char * const builtin_fsmonitor__daemon_usage[] = {
N_("git fsmonitor--daemon start [<options>]"), N_("git fsmonitor--daemon start [<options>]"),

View File

@ -37,6 +37,7 @@
#include "gettext.h" #include "gettext.h"
#include "hook.h" #include "hook.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
#include "wrapper.h" #include "wrapper.h"
#define FAILED_RUN "failed to run %s" #define FAILED_RUN "failed to run %s"

View File

@ -16,6 +16,7 @@
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "send-pack.h" #include "send-pack.h"
#include "trace2.h"
#include "color.h" #include "color.h"
static const char * const push_usage[] = { static const char * const push_usage[] = {

View File

@ -32,6 +32,7 @@
#include "sequencer.h" #include "sequencer.h"
#include "rebase-interactive.h" #include "rebase-interactive.h"
#include "reset.h" #include "reset.h"
#include "trace2.h"
#include "hook.h" #include "hook.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -32,6 +32,8 @@
#include "object-store.h" #include "object-store.h"
#include "protocol.h" #include "protocol.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "shallow.h" #include "shallow.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -29,6 +29,8 @@
#include "setup.h" #include "setup.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace.h"
#include "trace2.h"
#include "dir.h" #include "dir.h"
#include "add-interactive.h" #include "add-interactive.h"

View File

@ -11,6 +11,8 @@
#include "replace-object.h" #include "replace-object.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "sparse-index.h" #include "sparse-index.h"
#include "trace.h"
#include "trace2.h"
#ifndef DEBUG_CACHE_TREE #ifndef DEBUG_CACHE_TREE
#define DEBUG_CACHE_TREE 0 #define DEBUG_CACHE_TREE 0

View File

@ -8,8 +8,6 @@
#include "advice.h" #include "advice.h"
#include "gettext.h" #include "gettext.h"
#include "convert.h" #include "convert.h"
#include "trace.h"
#include "trace2.h"
#include "string-list.h" #include "string-list.h"
#include "pack-revindex.h" #include "pack-revindex.h"
#include "hash.h" #include "hash.h"

View File

@ -3,6 +3,7 @@
#include "chdir-notify.h" #include "chdir-notify.h"
#include "list.h" #include "list.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace.h"
struct chdir_notify_entry { struct chdir_notify_entry {
const char *name; const char *name;

View File

@ -3,6 +3,7 @@
#include "gettext.h" #include "gettext.h"
#include "attr.h" #include "attr.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
/* /*
* Many parts of Git have subprograms communicate via pipe, expect the * Many parts of Git have subprograms communicate via pipe, expect the

View File

@ -4,6 +4,7 @@
#include "fsm-listen.h" #include "fsm-listen.h"
#include "fsmonitor--daemon.h" #include "fsmonitor--daemon.h"
#include "gettext.h" #include "gettext.h"
#include "trace2.h"
/* /*
* The documentation of ReadDirectoryChangesW() states that the maximum * The documentation of ReadDirectoryChangesW() states that the maximum

View File

@ -12,6 +12,7 @@
#include "win32/lazyload.h" #include "win32/lazyload.h"
#include "../config.h" #include "../config.h"
#include "../environment.h" #include "../environment.h"
#include "../trace2.h"
#include "../wrapper.h" #include "../wrapper.h"
#include "dir.h" #include "dir.h"
#include "gettext.h" #include "gettext.h"

View File

@ -4,6 +4,7 @@
#include "strbuf.h" #include "strbuf.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace2.h"
#include "unix-socket.h" #include "unix-socket.h"
#include "unix-stream-server.h" #include "unix-stream-server.h"

View File

@ -5,6 +5,8 @@
#include "strbuf.h" #include "strbuf.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace.h"
#include "trace2.h"
#include "accctrl.h" #include "accctrl.h"
#include "aclapi.h" #include "aclapi.h"

View File

@ -1,5 +1,6 @@
#include "../../cache.h" #include "../../cache.h"
#include "../../json-writer.h" #include "../../json-writer.h"
#include "../../trace2.h"
#include "lazyload.h" #include "lazyload.h"
#include <Psapi.h> #include <Psapi.h>
#include <tlHelp32.h> #include <tlHelp32.h>

View File

@ -28,6 +28,7 @@
#include "replace-object.h" #include "replace-object.h"
#include "refs.h" #include "refs.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h" #include "wrapper.h"
#include "write-or-die.h" #include "write-or-die.h"

View File

@ -14,6 +14,7 @@
#include "string-list.h" #include "string-list.h"
#include "oid-array.h" #include "oid-array.h"
#include "transport.h" #include "transport.h"
#include "trace2.h"
#include "strbuf.h" #include "strbuf.h"
#include "version.h" #include "version.h"
#include "protocol.h" #include "protocol.h"

View File

@ -9,6 +9,7 @@
#include "sigchain.h" #include "sigchain.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "sub-process.h" #include "sub-process.h"
#include "trace.h"
#include "utf8.h" #include "utf8.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -13,6 +13,7 @@
#include "unpack-trees.h" #include "unpack-trees.h"
#include "refs.h" #include "refs.h"
#include "submodule.h" #include "submodule.h"
#include "trace.h"
#include "dir.h" #include "dir.h"
#include "fsmonitor.h" #include "fsmonitor.h"
#include "commit-reach.h" #include "commit-reach.h"

1
dir.c
View File

@ -23,6 +23,7 @@
#include "fsmonitor.h" #include "fsmonitor.h"
#include "setup.h" #include "setup.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace2.h"
#include "wrapper.h" #include "wrapper.h"
/* /*

View File

@ -24,6 +24,7 @@
#include "chdir-notify.h" #include "chdir-notify.h"
#include "setup.h" #include "setup.h"
#include "shallow.h" #include "shallow.h"
#include "trace.h"
#include "wrapper.h" #include "wrapper.h"
#include "write-or-die.h" #include "write-or-die.h"

View File

@ -5,6 +5,8 @@
#include "gettext.h" #include "gettext.h"
#include "quote.h" #include "quote.h"
#include "strvec.h" #include "strvec.h"
#include "trace.h"
#include "trace2.h"
#if defined(RUNTIME_PREFIX) #if defined(RUNTIME_PREFIX)

View File

@ -17,6 +17,7 @@
#include "remote.h" #include "remote.h"
#include "run-command.h" #include "run-command.h"
#include "connect.h" #include "connect.h"
#include "trace2.h"
#include "transport.h" #include "transport.h"
#include "version.h" #include "version.h"
#include "oid-array.h" #include "oid-array.h"

View File

@ -7,6 +7,7 @@
#include "fsmonitor-ipc.h" #include "fsmonitor-ipc.h"
#include "run-command.h" #include "run-command.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace2.h"
#define INDEX_EXTENSION_VERSION1 (1) #define INDEX_EXTENSION_VERSION1 (1)
#define INDEX_EXTENSION_VERSION2 (2) #define INDEX_EXTENSION_VERSION2 (2)

View File

@ -4,6 +4,7 @@
#include "cache.h" #include "cache.h"
#include "dir.h" #include "dir.h"
#include "fsmonitor-settings.h" #include "fsmonitor-settings.h"
#include "trace.h"
extern struct trace_key trace_fsmonitor; extern struct trace_key trace_fsmonitor;

2
git.c
View File

@ -9,6 +9,8 @@
#include "replace-object.h" #include "replace-object.h"
#include "setup.h" #include "setup.h"
#include "shallow.h" #include "shallow.h"
#include "trace.h"
#include "trace2.h"
#define RUN_SETUP (1<<0) #define RUN_SETUP (1<<0)
#define RUN_SETUP_GENTLY (1<<1) #define RUN_SETUP_GENTLY (1<<1)

1
http.c
View File

@ -12,6 +12,7 @@
#include "version.h" #include "version.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "gettext.h" #include "gettext.h"
#include "trace.h"
#include "transport.h" #include "transport.h"
#include "packfile.h" #include "packfile.h"
#include "protocol.h" #include "protocol.h"

View File

@ -37,6 +37,7 @@
#include "strmap.h" #include "strmap.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "submodule.h" #include "submodule.h"
#include "trace2.h"
#include "tree.h" #include "tree.h"
#include "unpack-trees.h" #include "unpack-trees.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"

View File

@ -9,6 +9,7 @@
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace.h"
#include "trace2.h" #include "trace2.h"
#include "sparse-index.h" #include "sparse-index.h"

View File

@ -13,6 +13,7 @@
#include "notes.h" #include "notes.h"
#include "notes-merge.h" #include "notes-merge.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace.h"
#include "notes-utils.h" #include "notes-utils.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -15,6 +15,7 @@
#include "pack-objects.h" #include "pack-objects.h"
#include "packfile.h" #include "packfile.h"
#include "repository.h" #include "repository.h"
#include "trace2.h"
#include "object-store.h" #include "object-store.h"
#include "list-objects-filter-options.h" #include "list-objects-filter-options.h"
#include "midx.h" #include "midx.h"

View File

@ -3,6 +3,7 @@
#include "pack-revindex.h" #include "pack-revindex.h"
#include "object-store.h" #include "object-store.h"
#include "packfile.h" #include "packfile.h"
#include "trace2.h"
#include "config.h" #include "config.h"
#include "midx.h" #include "midx.h"

View File

@ -15,6 +15,7 @@
#include "commit.h" #include "commit.h"
#include "object.h" #include "object.h"
#include "tag.h" #include "tag.h"
#include "trace.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "tree.h" #include "tree.h"
#include "object-store.h" #include "object-store.h"

View File

@ -3,6 +3,7 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "run-command.h" #include "run-command.h"
#include "trace.h"
#include "wrapper.h" #include "wrapper.h"
#include "write-or-die.h" #include "write-or-die.h"

View File

@ -11,6 +11,7 @@
#include "progress.h" #include "progress.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "repository.h" #include "repository.h"
#include "trace2.h"
/* /*
* Mostly randomly chosen maximum thread counts: we * Mostly randomly chosen maximum thread counts: we

View File

@ -13,6 +13,7 @@
#include "progress.h" #include "progress.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace.h" #include "trace.h"
#include "trace2.h"
#include "utf8.h" #include "utf8.h"
#include "config.h" #include "config.h"

View File

@ -4,6 +4,7 @@
#include "object-store.h" #include "object-store.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "config.h" #include "config.h"
#include "trace2.h"
#include "transport.h" #include "transport.h"
#include "strvec.h" #include "strvec.h"
#include "packfile.h" #include "packfile.h"

View File

@ -2,6 +2,7 @@
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "protocol.h" #include "protocol.h"
#include "trace2.h"
static enum protocol_version parse_protocol_version(const char *value) static enum protocol_version parse_protocol_version(const char *value)
{ {

View File

@ -23,6 +23,7 @@
#include "resolve-undo.h" #include "resolve-undo.h"
#include "run-command.h" #include "run-command.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace2.h"
#include "varint.h" #include "varint.h"
#include "split-index.h" #include "split-index.h"
#include "utf8.h" #include "utf8.h"

View File

@ -21,6 +21,7 @@
#include "setup.h" #include "setup.h"
#include "protocol.h" #include "protocol.h"
#include "quote.h" #include "quote.h"
#include "trace2.h"
#include "transport.h" #include "transport.h"
#include "write-or-die.h" #include "write-or-die.h"

View File

@ -14,6 +14,7 @@
#include "setup.h" #include "setup.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "sparse-index.h" #include "sparse-index.h"
#include "trace2.h"
#include "promisor-remote.h" #include "promisor-remote.h"
/* The main repository */ /* The main repository */

View File

@ -31,6 +31,7 @@
#include "worktree.h" #include "worktree.h"
#include "setup.h" #include "setup.h"
#include "strvec.h" #include "strvec.h"
#include "trace2.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "prio-queue.h" #include "prio-queue.h"

View File

@ -8,6 +8,8 @@
#include "thread-utils.h" #include "thread-utils.h"
#include "strbuf.h" #include "strbuf.h"
#include "string-list.h" #include "string-list.h"
#include "trace.h"
#include "trace2.h"
#include "quote.h" #include "quote.h"
#include "config.h" #include "config.h"
#include "packfile.h" #include "packfile.h"

View File

@ -16,6 +16,7 @@
#include "packfile.h" #include "packfile.h"
#include "help.h" #include "help.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
static void setup_enlistment_directory(int argc, const char **argv, static void setup_enlistment_directory(int argc, const char **argv,
const char * const *usagestr, const char * const *usagestr,

View File

@ -10,6 +10,7 @@
#include "chdir-notify.h" #include "chdir-notify.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "quote.h" #include "quote.h"
#include "trace2.h"
static int inside_git_dir = -1; static int inside_git_dir = -1;
static int inside_work_tree = -1; static int inside_work_tree = -1;

View File

@ -17,6 +17,7 @@
#include "list-objects.h" #include "list-objects.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "shallow.h" #include "shallow.h"
#include "trace.h"
#include "wrapper.h" #include "wrapper.h"
void set_alternate_shallow_file(struct repository *r, const char *path, int override) void set_alternate_shallow_file(struct repository *r, const char *path, int override)

View File

@ -28,6 +28,7 @@
#include "commit-reach.h" #include "commit-reach.h"
#include "setup.h" #include "setup.h"
#include "shallow.h" #include "shallow.h"
#include "trace2.h"
static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF; static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
static int initialized_fetch_ref_tips; static int initialized_fetch_ref_tips;

View File

@ -1,6 +1,7 @@
#include "test-tool.h" #include "test-tool.h"
#include "cache.h" #include "cache.h"
#include "date.h" #include "date.h"
#include "trace.h"
static const char *usage_msg = "\n" static const char *usage_msg = "\n"
" test-tool date relative [time_t]...\n" " test-tool date relative [time_t]...\n"

View File

@ -4,6 +4,7 @@
#include "environment.h" #include "environment.h"
#include "parse-options.h" #include "parse-options.h"
#include "setup.h" #include "setup.h"
#include "trace.h"
static int single; static int single;
static int multi; static int multi;

View File

@ -4,6 +4,7 @@
#include "environment.h" #include "environment.h"
#include "setup.h" #include "setup.h"
#include "string-list.h" #include "string-list.h"
#include "trace.h"
#include "utf8.h" #include "utf8.h"
/* /*

View File

@ -26,6 +26,7 @@
#include "environment.h" #include "environment.h"
#include "quote.h" #include "quote.h"
#include "setup.h" #include "setup.h"
#include "trace.h"
#include "wrapper.h" #include "wrapper.h"
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 }; struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };

View File

@ -7,6 +7,7 @@
#include "thread-utils.h" #include "thread-utils.h"
#include "version.h" #include "version.h"
#include "trace.h" #include "trace.h"
#include "trace2.h"
#include "trace2/tr2_cfg.h" #include "trace2/tr2_cfg.h"
#include "trace2/tr2_cmd_name.h" #include "trace2/tr2_cmd_name.h"
#include "trace2/tr2_ctr.h" #include "trace2/tr2_ctr.h"

View File

@ -22,6 +22,7 @@
#include "string-list.h" #include "string-list.h"
#include "oid-array.h" #include "oid-array.h"
#include "sigchain.h" #include "sigchain.h"
#include "trace2.h"
#include "transport-internal.h" #include "transport-internal.h"
#include "protocol.h" #include "protocol.h"
#include "object-store.h" #include "object-store.h"

View File

@ -5,6 +5,7 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-store.h" #include "object-store.h"
#include "trace2.h"
#include "tree.h" #include "tree.h"
#include "pathspec.h" #include "pathspec.h"
#include "json-writer.h" #include "json-writer.h"

View File

@ -17,6 +17,7 @@
#include "sparse-index.h" #include "sparse-index.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace2.h"
#include "fsmonitor.h" #include "fsmonitor.h"
#include "object-store.h" #include "object-store.h"
#include "promisor-remote.h" #include "promisor-remote.h"

View File

@ -22,6 +22,7 @@
#include "version.h" #include "version.h"
#include "string-list.h" #include "string-list.h"
#include "strvec.h" #include "strvec.h"
#include "trace2.h"
#include "prio-queue.h" #include "prio-queue.h"
#include "protocol.h" #include "protocol.h"
#include "quote.h" #include "quote.h"

View File

@ -5,6 +5,7 @@
#include "abspath.h" #include "abspath.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "trace2.h"
#include "wrapper.h" #include "wrapper.h"
static intmax_t count_fsync_writeout_only; static intmax_t count_fsync_writeout_only;

View File

@ -18,6 +18,8 @@
#include "column.h" #include "column.h"
#include "setup.h" #include "setup.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace.h"
#include "trace2.h"
#include "utf8.h" #include "utf8.h"
#include "worktree.h" #include "worktree.h"
#include "lockfile.h" #include "lockfile.h"