Skip to content

Commit b7b189c

Browse files
newrengitster
authored andcommitted
treewide: reduce includes of cache.h in other headers
We had a handful of headers including cache.h that didn't need to anymore. Drop those includes and replace them with includes of smaller files, or forward declarations. However, note that two .c files now need to directly include cache.h, though they should have been including it all along given they are directly using structs defined in it. Signed-off-by: Elijah Newren <newren@gmail.com> Acked-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 65156bb commit b7b189c

File tree

8 files changed

+15
-8
lines changed

8 files changed

+15
-8
lines changed

archive.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef ARCHIVE_H
22
#define ARCHIVE_H
33

4-
#include "cache.h"
54
#include "object-name.h"
65
#include "pathspec.h"
6+
#include "string-list.h"
77

88
struct repository;
99
struct pretty_print_context;

chdir-notify.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "abspath.h"
33
#include "chdir-notify.h"
44
#include "list.h"
5+
#include "path.h"
56
#include "strbuf.h"
67
#include "trace.h"
78

quote.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "alloc.h"
3+
#include "path.h"
34
#include "quote.h"
45
#include "strbuf.h"
56
#include "strvec.h"

refs/ref-cache.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef REFS_REF_CACHE_H
22
#define REFS_REF_CACHE_H
33

4-
#include "cache.h"
4+
#include "hash.h"
55

66
struct ref_dir;
77
struct ref_store;

rerere.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "git-compat-util.h"
1+
#include "cache.h"
22
#include "abspath.h"
33
#include "alloc.h"
44
#include "config.h"

resolve-undo.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#ifndef RESOLVE_UNDO_H
22
#define RESOLVE_UNDO_H
33

4-
#include "cache.h"
4+
struct cache_entry;
5+
struct index_state;
6+
struct pathspec;
7+
struct string_list;
8+
9+
#include "hash.h"
510

611
struct resolve_undo_info {
712
unsigned int mode[3];

revision.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "git-compat-util.h"
1+
#include "cache.h"
22
#include "alloc.h"
33
#include "config.h"
44
#include "environment.h"

split-index.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef SPLIT_INDEX_H
22
#define SPLIT_INDEX_H
33

4-
#include "cache.h"
4+
#include "hash.h"
55

66
struct index_state;
77
struct strbuf;

0 commit comments

Comments
 (0)