Skip to content

Commit 6047b28

Browse files
committed
Merge branch 'en/header-split-cleanup'
Split key function and data structure definitions out of cache.h to new header files and adjust the users. * en/header-split-cleanup: csum-file.h: remove unnecessary inclusion of cache.h write-or-die.h: move declarations for write-or-die.c functions from cache.h treewide: remove cache.h inclusion due to setup.h changes setup.h: move declarations for setup.c functions from cache.h treewide: remove cache.h inclusion due to environment.h changes environment.h: move declarations for environment.c functions from cache.h treewide: remove unnecessary includes of cache.h wrapper.h: move declarations for wrapper.c functions from cache.h path.h: move function declarations for path.c functions from cache.h cache.h: remove expand_user_path() abspath.h: move absolute path functions from cache.h environment: move comment_line_char from cache.h treewide: remove unnecessary cache.h inclusion from several sources treewide: remove unnecessary inclusion of gettext.h treewide: be explicit about dependence on gettext.h treewide: remove unnecessary cache.h inclusion from a few headers
2 parents 72871b1 + ec2f026 commit 6047b28

File tree

340 files changed

+1311
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+1311
-669
lines changed

abspath.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
2+
#include "abspath.h"
3+
#include "strbuf.h"
24

35
/*
46
* Do not use this for inspecting *tracked* content. When path is a

abspath.h

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef ABSPATH_H
2+
#define ABSPATH_H
3+
4+
int is_directory(const char *);
5+
char *strbuf_realpath(struct strbuf *resolved, const char *path,
6+
int die_on_error);
7+
char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
8+
int die_on_error);
9+
char *real_pathdup(const char *path, int die_on_error);
10+
const char *absolute_path(const char *path);
11+
char *absolute_pathdup(const char *path);
12+
13+
/*
14+
* Concatenate "prefix" (if len is non-zero) and "path", with no
15+
* connecting characters (so "prefix" should end with a "/").
16+
* Unlike prefix_path, this should be used if the named file does
17+
* not have to interact with index entry; i.e. name of a random file
18+
* on the filesystem.
19+
*
20+
* The return value is always a newly allocated string (even if the
21+
* prefix was empty).
22+
*/
23+
char *prefix_filename(const char *prefix, const char *path);
24+
25+
/* Likewise, but path=="-" always yields "-" */
26+
char *prefix_filename_except_for_dash(const char *prefix, const char *path);
27+
28+
static inline int is_absolute_path(const char *path)
29+
{
30+
return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
31+
}
32+
33+
#endif /* ABSPATH_H */

add-interactive.c

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "color.h"
44
#include "config.h"
55
#include "diffcore.h"
6+
#include "gettext.h"
67
#include "hex.h"
78
#include "revision.h"
89
#include "refs.h"

add-patch.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "cache.h"
22
#include "add-interactive.h"
33
#include "alloc.h"
4+
#include "environment.h"
5+
#include "gettext.h"
46
#include "strbuf.h"
57
#include "run-command.h"
68
#include "strvec.h"

apply.c

+5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
*/
99

1010
#include "cache.h"
11+
#include "abspath.h"
1112
#include "alloc.h"
1213
#include "config.h"
1314
#include "object-store.h"
1415
#include "blob.h"
1516
#include "delta.h"
1617
#include "diff.h"
1718
#include "dir.h"
19+
#include "environment.h"
20+
#include "gettext.h"
1821
#include "hex.h"
1922
#include "xdiff-interface.h"
2023
#include "ll-merge.h"
@@ -24,6 +27,8 @@
2427
#include "rerere.h"
2528
#include "apply.h"
2629
#include "entry.h"
30+
#include "setup.h"
31+
#include "wrapper.h"
2732

2833
struct gitdiff_data {
2934
struct strbuf *root;

archive-tar.c

+2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
#include "git-compat-util.h"
55
#include "alloc.h"
66
#include "config.h"
7+
#include "gettext.h"
78
#include "hex.h"
89
#include "tar.h"
910
#include "archive.h"
1011
#include "object-store.h"
1112
#include "streaming.h"
1213
#include "run-command.h"
14+
#include "write-or-die.h"
1315

1416
#define RECORDSIZE (512)
1517
#define BLOCKSIZE (RECORDSIZE * 20)

archive-zip.c

+2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
#include "cache.h"
55
#include "config.h"
66
#include "archive.h"
7+
#include "gettext.h"
78
#include "hex.h"
89
#include "streaming.h"
910
#include "utf8.h"
1011
#include "object-store.h"
1112
#include "userdiff.h"
13+
#include "write-or-die.h"
1214
#include "xdiff-interface.h"
1315
#include "date.h"
1416

archive.c

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "git-compat-util.h"
2+
#include "abspath.h"
23
#include "alloc.h"
34
#include "config.h"
5+
#include "environment.h"
6+
#include "gettext.h"
47
#include "hex.h"
8+
#include "setup.h"
59
#include "refs.h"
610
#include "object-store.h"
711
#include "commit.h"

attr.c

+3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
#include "cache.h"
1010
#include "alloc.h"
1111
#include "config.h"
12+
#include "environment.h"
1213
#include "exec-cmd.h"
1314
#include "attr.h"
1415
#include "dir.h"
16+
#include "gettext.h"
1517
#include "utf8.h"
1618
#include "quote.h"
1719
#include "revision.h"
1820
#include "object-store.h"
21+
#include "setup.h"
1922
#include "thread-utils.h"
2023

2124
const char git_attr__true[] = "(builtin)true";

bisect.c

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "config.h"
33
#include "commit.h"
44
#include "diff.h"
5+
#include "environment.h"
6+
#include "gettext.h"
57
#include "hex.h"
68
#include "revision.h"
79
#include "refs.h"

blame.c

+2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include "mergesort.h"
66
#include "diff.h"
77
#include "diffcore.h"
8+
#include "gettext.h"
89
#include "hex.h"
10+
#include "setup.h"
911
#include "tag.h"
1012
#include "blame.h"
1113
#include "alloc.h"

branch.c

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "cache.h"
33
#include "config.h"
44
#include "branch.h"
5+
#include "environment.h"
6+
#include "gettext.h"
57
#include "hex.h"
68
#include "refs.h"
79
#include "refspec.h"

builtin/add.c

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "builtin.h"
1010
#include "lockfile.h"
1111
#include "dir.h"
12+
#include "gettext.h"
1213
#include "pathspec.h"
1314
#include "exec-cmd.h"
1415
#include "cache-tree.h"

builtin/am.c

+4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
*/
66
#define USE_THE_INDEX_VARIABLE
77
#include "cache.h"
8+
#include "abspath.h"
89
#include "config.h"
910
#include "builtin.h"
11+
#include "environment.h"
1012
#include "exec-cmd.h"
13+
#include "gettext.h"
1114
#include "hex.h"
1215
#include "parse-options.h"
1316
#include "dir.h"
@@ -36,6 +39,7 @@
3639
#include "packfile.h"
3740
#include "repository.h"
3841
#include "pretty.h"
42+
#include "wrapper.h"
3943

4044
/**
4145
* Returns the length of the first line of msg.

builtin/apply.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "cache.h"
22
#include "builtin.h"
3+
#include "gettext.h"
34
#include "parse-options.h"
45
#include "apply.h"
56

builtin/archive.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "cache.h"
66
#include "builtin.h"
77
#include "archive.h"
8+
#include "gettext.h"
89
#include "transport.h"
910
#include "parse-options.h"
1011
#include "pkt-line.h"

builtin/bisect.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "builtin.h"
22
#include "cache.h"
3+
#include "environment.h"
4+
#include "gettext.h"
35
#include "hex.h"
46
#include "parse-options.h"
57
#include "bisect.h"
@@ -10,6 +12,7 @@
1012
#include "prompt.h"
1113
#include "quote.h"
1214
#include "revision.h"
15+
#include "wrapper.h"
1316

1417
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
1518
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")

builtin/blame.c

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "config.h"
1111
#include "color.h"
1212
#include "builtin.h"
13+
#include "environment.h"
14+
#include "gettext.h"
1315
#include "hex.h"
1416
#include "repository.h"
1517
#include "commit.h"
@@ -29,7 +31,9 @@
2931
#include "object-store.h"
3032
#include "blame.h"
3133
#include "refs.h"
34+
#include "setup.h"
3235
#include "tag.h"
36+
#include "write-or-die.h"
3337

3438
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
3539
static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");

builtin/branch.c

+3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
#include "cache.h"
99
#include "config.h"
1010
#include "color.h"
11+
#include "environment.h"
1112
#include "refs.h"
1213
#include "commit.h"
1314
#include "builtin.h"
15+
#include "gettext.h"
1416
#include "remote.h"
1517
#include "parse-options.h"
1618
#include "branch.h"
@@ -24,6 +26,7 @@
2426
#include "worktree.h"
2527
#include "help.h"
2628
#include "commit-reach.h"
29+
#include "wrapper.h"
2730

2831
static const char * const builtin_branch_usage[] = {
2932
N_("git branch [<options>] [-r | -a] [--merged] [--no-merged]"),

builtin/bugreport.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#include "builtin.h"
2+
#include "abspath.h"
3+
#include "gettext.h"
24
#include "parse-options.h"
35
#include "strbuf.h"
46
#include "help.h"
57
#include "compat/compiler.h"
68
#include "hook.h"
79
#include "hook-list.h"
810
#include "diagnose.h"
9-
11+
#include "setup.h"
12+
#include "wrapper.h"
1013

1114
static void get_system_info(struct strbuf *sys_info)
1215
{

builtin/bundle.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include "builtin.h"
2+
#include "abspath.h"
3+
#include "gettext.h"
4+
#include "setup.h"
25
#include "strvec.h"
36
#include "parse-options.h"
47
#include "cache.h"

builtin/cat-file.c

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "config.h"
1010
#include "builtin.h"
1111
#include "diff.h"
12+
#include "environment.h"
13+
#include "gettext.h"
1214
#include "hex.h"
1315
#include "ident.h"
1416
#include "parse-options.h"
@@ -21,6 +23,7 @@
2123
#include "replace-object.h"
2224
#include "promisor-remote.h"
2325
#include "mailmap.h"
26+
#include "write-or-die.h"
2427

2528
enum batch_mode {
2629
BATCH_MODE_CONTENTS,

builtin/check-attr.c

+4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
#include "cache.h"
44
#include "config.h"
55
#include "attr.h"
6+
#include "environment.h"
7+
#include "gettext.h"
68
#include "quote.h"
9+
#include "setup.h"
710
#include "parse-options.h"
11+
#include "write-or-die.h"
812

913
static int all_attrs;
1014
static int cached_attrs;

builtin/check-ignore.c

+2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#include "cache.h"
44
#include "config.h"
55
#include "dir.h"
6+
#include "gettext.h"
67
#include "quote.h"
78
#include "pathspec.h"
89
#include "parse-options.h"
910
#include "submodule.h"
11+
#include "write-or-die.h"
1012

1113
static int quiet, verbose, stdin_paths, show_non_matching, no_index;
1214
static const char * const check_ignore_usage[] = {

builtin/check-mailmap.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include "builtin.h"
22
#include "config.h"
3+
#include "gettext.h"
34
#include "ident.h"
45
#include "mailmap.h"
56
#include "parse-options.h"
67
#include "string-list.h"
8+
#include "write-or-die.h"
79

810
static int use_stdin;
911
static const char * const check_mailmap_usage[] = {

builtin/check-ref-format.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "cache.h"
66
#include "refs.h"
77
#include "builtin.h"
8+
#include "setup.h"
89
#include "strbuf.h"
910

1011
static const char builtin_check_ref_format_usage[] =

builtin/checkout--worker.c

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "alloc.h"
33
#include "config.h"
44
#include "entry.h"
5+
#include "gettext.h"
56
#include "parallel-checkout.h"
67
#include "parse-options.h"
78
#include "pkt-line.h"

builtin/checkout-index.c

+2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
#include "builtin.h"
99
#include "config.h"
1010
#include "dir.h"
11+
#include "gettext.h"
1112
#include "lockfile.h"
1213
#include "quote.h"
1314
#include "cache-tree.h"
1415
#include "parse-options.h"
1516
#include "entry.h"
1617
#include "parallel-checkout.h"
18+
#include "setup.h"
1719

1820
#define CHECKOUT_ALL 4
1921
static int nul_term_line;

builtin/checkout.c

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "config.h"
1010
#include "diff.h"
1111
#include "dir.h"
12+
#include "environment.h"
13+
#include "gettext.h"
1214
#include "hex.h"
1315
#include "hook.h"
1416
#include "ll-merge.h"
@@ -21,6 +23,7 @@
2123
#include "resolve-undo.h"
2224
#include "revision.h"
2325
#include "run-command.h"
26+
#include "setup.h"
2427
#include "submodule.h"
2528
#include "submodule-config.h"
2629
#include "tree.h"

0 commit comments

Comments
 (0)