Skip to content

Commit

Permalink
treewide: be explicit about dependence on trace.h & trace2.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
newren authored and gitster committed Apr 11, 2023
1 parent e7dca80 commit 74ea5c9
Show file tree
Hide file tree
Showing 62 changed files with 70 additions and 2 deletions.
1 change: 1 addition & 0 deletions blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "hex.h"
#include "setup.h"
#include "tag.h"
#include "trace2.h"
#include "blame.h"
#include "alloc.h"
#include "commit-slab.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "trace2.h"
#include "tree.h"
#include "tree-walk.h"
#include "unpack-trees.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "progress.h"
#include "replace-object.h"
#include "tag.h"
#include "trace2.h"

#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]")
Expand Down
2 changes: 2 additions & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "promisor-remote.h"
#include "commit-graph.h"
#include "shallow.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h"
#include "bundle-uri.h"

Expand Down
1 change: 1 addition & 0 deletions builtin/fsmonitor--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "simple-ipc.h"
#include "khash.h"
#include "pkt-line.h"
#include "trace2.h"

static const char * const builtin_fsmonitor__daemon_usage[] = {
N_("git fsmonitor--daemon start [<options>]"),
Expand Down
1 change: 1 addition & 0 deletions builtin/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "gettext.h"
#include "hook.h"
#include "setup.h"
#include "trace2.h"
#include "wrapper.h"

#define FAILED_RUN "failed to run %s"
Expand Down
1 change: 1 addition & 0 deletions builtin/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "submodule.h"
#include "submodule-config.h"
#include "send-pack.h"
#include "trace2.h"
#include "color.h"

static const char * const push_usage[] = {
Expand Down
1 change: 1 addition & 0 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "sequencer.h"
#include "rebase-interactive.h"
#include "reset.h"
#include "trace2.h"
#include "hook.h"
#include "wrapper.h"

Expand Down
2 changes: 2 additions & 0 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "object-store.h"
#include "protocol.h"
#include "commit-reach.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h"
#include "shallow.h"
#include "wrapper.h"
Expand Down
2 changes: 2 additions & 0 deletions builtin/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "trace.h"
#include "trace2.h"
#include "dir.h"
#include "add-interactive.h"

Expand Down
2 changes: 2 additions & 0 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "replace-object.h"
#include "promisor-remote.h"
#include "sparse-index.h"
#include "trace.h"
#include "trace2.h"

#ifndef DEBUG_CACHE_TREE
#define DEBUG_CACHE_TREE 0
Expand Down
2 changes: 0 additions & 2 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "advice.h"
#include "gettext.h"
#include "convert.h"
#include "trace.h"
#include "trace2.h"
#include "string-list.h"
#include "pack-revindex.h"
#include "hash.h"
Expand Down
1 change: 1 addition & 0 deletions chdir-notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "chdir-notify.h"
#include "list.h"
#include "strbuf.h"
#include "trace.h"

struct chdir_notify_entry {
const char *name;
Expand Down
1 change: 1 addition & 0 deletions common-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "gettext.h"
#include "attr.h"
#include "setup.h"
#include "trace2.h"

/*
* Many parts of Git have subprograms communicate via pipe, expect the
Expand Down
1 change: 1 addition & 0 deletions compat/fsmonitor/fsm-listen-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "fsm-listen.h"
#include "fsmonitor--daemon.h"
#include "gettext.h"
#include "trace2.h"

/*
* The documentation of ReadDirectoryChangesW() states that the maximum
Expand Down
1 change: 1 addition & 0 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "win32/lazyload.h"
#include "../config.h"
#include "../environment.h"
#include "../trace2.h"
#include "../wrapper.h"
#include "dir.h"
#include "gettext.h"
Expand Down
1 change: 1 addition & 0 deletions compat/simple-ipc/ipc-unix-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "strbuf.h"
#include "pkt-line.h"
#include "thread-utils.h"
#include "trace2.h"
#include "unix-socket.h"
#include "unix-stream-server.h"

Expand Down
2 changes: 2 additions & 0 deletions compat/simple-ipc/ipc-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "strbuf.h"
#include "pkt-line.h"
#include "thread-utils.h"
#include "trace.h"
#include "trace2.h"
#include "accctrl.h"
#include "aclapi.h"

Expand Down
1 change: 1 addition & 0 deletions compat/win32/trace2_win32_process_info.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "../../cache.h"
#include "../../json-writer.h"
#include "../../trace2.h"
#include "lazyload.h"
#include <Psapi.h>
#include <tlHelp32.h>
Expand Down
1 change: 1 addition & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "replace-object.h"
#include "refs.h"
#include "setup.h"
#include "trace2.h"
#include "worktree.h"
#include "wrapper.h"
#include "write-or-die.h"
Expand Down
1 change: 1 addition & 0 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "string-list.h"
#include "oid-array.h"
#include "transport.h"
#include "trace2.h"
#include "strbuf.h"
#include "version.h"
#include "protocol.h"
Expand Down
1 change: 1 addition & 0 deletions convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "sigchain.h"
#include "pkt-line.h"
#include "sub-process.h"
#include "trace.h"
#include "utf8.h"
#include "ll-merge.h"
#include "wrapper.h"
Expand Down
1 change: 1 addition & 0 deletions diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "unpack-trees.h"
#include "refs.h"
#include "submodule.h"
#include "trace.h"
#include "dir.h"
#include "fsmonitor.h"
#include "commit-reach.h"
Expand Down
1 change: 1 addition & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "fsmonitor.h"
#include "setup.h"
#include "submodule-config.h"
#include "trace2.h"
#include "wrapper.h"

/*
Expand Down
1 change: 1 addition & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "chdir-notify.h"
#include "setup.h"
#include "shallow.h"
#include "trace.h"
#include "wrapper.h"
#include "write-or-die.h"

Expand Down
2 changes: 2 additions & 0 deletions exec-cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "gettext.h"
#include "quote.h"
#include "strvec.h"
#include "trace.h"
#include "trace2.h"

#if defined(RUNTIME_PREFIX)

Expand Down
1 change: 1 addition & 0 deletions fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "remote.h"
#include "run-command.h"
#include "connect.h"
#include "trace2.h"
#include "transport.h"
#include "version.h"
#include "oid-array.h"
Expand Down
1 change: 1 addition & 0 deletions fsmonitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "fsmonitor-ipc.h"
#include "run-command.h"
#include "strbuf.h"
#include "trace2.h"

#define INDEX_EXTENSION_VERSION1 (1)
#define INDEX_EXTENSION_VERSION2 (2)
Expand Down
1 change: 1 addition & 0 deletions fsmonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "cache.h"
#include "dir.h"
#include "fsmonitor-settings.h"
#include "trace.h"

extern struct trace_key trace_fsmonitor;

Expand Down
2 changes: 2 additions & 0 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "replace-object.h"
#include "setup.h"
#include "shallow.h"
#include "trace.h"
#include "trace2.h"

#define RUN_SETUP (1<<0)
#define RUN_SETUP_GENTLY (1<<1)
Expand Down
1 change: 1 addition & 0 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "version.h"
#include "pkt-line.h"
#include "gettext.h"
#include "trace.h"
#include "transport.h"
#include "packfile.h"
#include "protocol.h"
Expand Down
1 change: 1 addition & 0 deletions merge-ort.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "strmap.h"
#include "submodule-config.h"
#include "submodule.h"
#include "trace2.h"
#include "tree.h"
#include "unpack-trees.h"
#include "xdiff-interface.h"
Expand Down
1 change: 1 addition & 0 deletions name-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "environment.h"
#include "gettext.h"
#include "thread-utils.h"
#include "trace.h"
#include "trace2.h"
#include "sparse-index.h"

Expand Down
1 change: 1 addition & 0 deletions notes-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "notes.h"
#include "notes-merge.h"
#include "strbuf.h"
#include "trace.h"
#include "notes-utils.h"
#include "commit-reach.h"
#include "wrapper.h"
Expand Down
1 change: 1 addition & 0 deletions pack-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "pack-objects.h"
#include "packfile.h"
#include "repository.h"
#include "trace2.h"
#include "object-store.h"
#include "list-objects-filter-options.h"
#include "midx.h"
Expand Down
1 change: 1 addition & 0 deletions pack-revindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "pack-revindex.h"
#include "object-store.h"
#include "packfile.h"
#include "trace2.h"
#include "config.h"
#include "midx.h"

Expand Down
1 change: 1 addition & 0 deletions packfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "commit.h"
#include "object.h"
#include "tag.h"
#include "trace.h"
#include "tree-walk.h"
#include "tree.h"
#include "object-store.h"
Expand Down
1 change: 1 addition & 0 deletions pkt-line.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "gettext.h"
#include "hex.h"
#include "run-command.h"
#include "trace.h"
#include "wrapper.h"
#include "write-or-die.h"

Expand Down
1 change: 1 addition & 0 deletions preload-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "progress.h"
#include "thread-utils.h"
#include "repository.h"
#include "trace2.h"

/*
* Mostly randomly chosen maximum thread counts: we
Expand Down
1 change: 1 addition & 0 deletions progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "progress.h"
#include "strbuf.h"
#include "trace.h"
#include "trace2.h"
#include "utf8.h"
#include "config.h"

Expand Down
1 change: 1 addition & 0 deletions promisor-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "object-store.h"
#include "promisor-remote.h"
#include "config.h"
#include "trace2.h"
#include "transport.h"
#include "strvec.h"
#include "packfile.h"
Expand Down
1 change: 1 addition & 0 deletions protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "config.h"
#include "environment.h"
#include "protocol.h"
#include "trace2.h"

static enum protocol_version parse_protocol_version(const char *value)
{
Expand Down
1 change: 1 addition & 0 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "resolve-undo.h"
#include "run-command.h"
#include "strbuf.h"
#include "trace2.h"
#include "varint.h"
#include "split-index.h"
#include "utf8.h"
Expand Down
1 change: 1 addition & 0 deletions remote-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "setup.h"
#include "protocol.h"
#include "quote.h"
#include "trace2.h"
#include "transport.h"
#include "write-or-die.h"

Expand Down
1 change: 1 addition & 0 deletions repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "setup.h"
#include "submodule-config.h"
#include "sparse-index.h"
#include "trace2.h"
#include "promisor-remote.h"

/* The main repository */
Expand Down
1 change: 1 addition & 0 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "worktree.h"
#include "setup.h"
#include "strvec.h"
#include "trace2.h"
#include "commit-reach.h"
#include "commit-graph.h"
#include "prio-queue.h"
Expand Down
2 changes: 2 additions & 0 deletions run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "thread-utils.h"
#include "strbuf.h"
#include "string-list.h"
#include "trace.h"
#include "trace2.h"
#include "quote.h"
#include "config.h"
#include "packfile.h"
Expand Down
1 change: 1 addition & 0 deletions scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "packfile.h"
#include "help.h"
#include "setup.h"
#include "trace2.h"

static void setup_enlistment_directory(int argc, const char **argv,
const char * const *usagestr,
Expand Down
1 change: 1 addition & 0 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "chdir-notify.h"
#include "promisor-remote.h"
#include "quote.h"
#include "trace2.h"

static int inside_git_dir = -1;
static int inside_work_tree = -1;
Expand Down
Loading

0 comments on commit 74ea5c9

Please sign in to comment.