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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 33 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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"

0 commit comments

Comments
 (0)