Skip to content

Commit a64acf7

Browse files
newrengitster
authored andcommitted
treewide: remove unnecessary includes of cache.h
The last several commits were geared at replacing the include of cache.h in strbuf.c with an include of git-compat-util.h. Unfortunately, I had to drop a patch moving some functions from cache.h to object-name.h, due to excessive conflicts with other in-flight topics. However, even without that patch, the series of patches so far allows us to modify a number of C files to replace an include of cache.h with git-compat-util.h. Do that to reduce our dependencies. (If we could have kept our object-name.h patch in this series, it would have also let us reduce the includes in checkout.c and fmt-merge-msg.c in addition to strbuf.c). Just to ensure that nothing else was bringing in cache.h, all of the affected files have been checked to ensure that gcc -E -I. $SOURCE_FILE | grep '"cache.h"' found no hits and that make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE} successfully compiles without warnings. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d5ebb50 commit a64acf7

File tree

12 files changed

+17
-12
lines changed

12 files changed

+17
-12
lines changed

compat/terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "compat/terminal.h"
33
#include "gettext.h"
44
#include "sigchain.h"

gpg-interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "commit.h"
33
#include "config.h"
44
#include "gettext.h"

lockfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2005, Junio C Hamano
33
*/
44

5-
#include "cache.h"
5+
#include "git-compat-util.h"
66
#include "abspath.h"
77
#include "gettext.h"
88
#include "lockfile.h"

parse-options.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "git-compat-util.h"
22
#include "parse-options.h"
33
#include "abspath.h"
4-
#include "cache.h"
54
#include "config.h"
65
#include "commit.h"
76
#include "color.h"

t/helper/test-delta.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "test-tool.h"
1212
#include "git-compat-util.h"
1313
#include "delta.h"
14-
#include "cache.h"
1514
#include "wrapper.h"
1615

1716
static const char usage_str[] =

t/helper/test-trace2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "test-tool.h"
2-
#include "cache.h"
32
#include "strvec.h"
43
#include "run-command.h"
54
#include "exec-cmd.h"
65
#include "config.h"
6+
#include "trace2.h"
77

88
typedef int(fn_unit_test)(int argc, const char **argv);
99

tempfile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
* file created by its parent.
4343
*/
4444

45-
#include "cache.h"
45+
#include "git-compat-util.h"
46+
#include "path.h"
4647
#include "tempfile.h"
4748
#include "sigchain.h"
4849
#include "wrapper.h"

trace2/tr2_cfg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "config.h"
3+
#include "strbuf.h"
4+
#include "trace2.h"
35
#include "trace2/tr2_cfg.h"
46
#include "trace2/tr2_sysenv.h"
57

trace2/tr2_cmd_name.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
2+
#include "strbuf.h"
23
#include "trace2/tr2_cmd_name.h"
34

45
#define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"

trace2/tr2_dst.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "abspath.h"
33
#include "sigchain.h"
4+
#include "strbuf.h"
45
#include "trace2/tr2_dst.h"
56
#include "trace2/tr2_sid.h"
67
#include "trace2/tr2_sysenv.h"

0 commit comments

Comments
 (0)