Skip to content

Commit fa79653

Browse files
szedergitster
authored andcommitted
commit-graph: clean up #includes
Our CodingGuidelines says that it's sufficient to include one of 'git-compat-util.h' and 'cache.h', but both 'commit-graph.c' and 'commit-graph.h' include both. Let's include only 'git-compat-util.h' to loose a bunch of unnecessary dependencies; but include 'hash.h', because 'commit-graph.h' does require the definition of 'struct object_id'. 'commit-graph.h' explicitly includes 'repository.h' and 'string-list.h', but only needs the declaration of a few structs from them. Drop these includes and forward-declare the necessary structs instead. 'commit-graph.c' includes 'dir.h', but doesn't actually use anything from there, so let's drop that #include as well. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ee3cb8 commit fa79653

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

commit-graph.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#include "cache.h"
2-
#include "config.h"
3-
#include "dir.h"
41
#include "git-compat-util.h"
2+
#include "config.h"
53
#include "lockfile.h"
64
#include "pack.h"
75
#include "packfile.h"

commit-graph.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#define COMMIT_GRAPH_H
33

44
#include "git-compat-util.h"
5-
#include "repository.h"
6-
#include "string-list.h"
7-
#include "cache.h"
85
#include "object-store.h"
96

107
#define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
@@ -22,6 +19,9 @@ void git_test_write_commit_graph_or_die(void);
2219

2320
struct commit;
2421
struct bloom_filter_settings;
22+
struct repository;
23+
struct raw_object_store;
24+
struct string_list;
2525

2626
char *get_commit_graph_filename(struct object_directory *odb);
2727
int open_commit_graph(const char *graph_file, int *fd, struct stat *st);

0 commit comments

Comments
 (0)