Skip to content

Commit a64215b

Browse files
newrengitster
authored andcommitted
object.h: stop depending on cache.h; make cache.h depend on object.h
Things should be able to depend on object.h without pulling in all of cache.h. Move an enum to allow this. Note that a couple files previously depended on things brought in through cache.h indirectly (revision.h -> commit.h -> object.h -> cache.h). As such, this change requires making existing dependencies more explicit in half a dozen files. The inclusion of strbuf.h in some headers if of particular note: these headers directly embedded a strbuf in some new structs, meaning they should have been including strbuf.h all along but were indirectly getting the necessary definitions. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5fa608 commit a64215b

17 files changed

+36
-32
lines changed

alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* up with maximal alignment because it doesn't know what the object alignment
99
* for the new allocation is.
1010
*/
11-
#include "cache.h"
11+
#include "git-compat-util.h"
1212
#include "object.h"
1313
#include "blob.h"
1414
#include "tree.h"

blame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef BLAME_H
22
#define BLAME_H
33

4-
#include "cache.h"
54
#include "commit.h"
65
#include "xdiff-interface.h"
76
#include "revision.h"

blob.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 "blob.h"
33
#include "repository.h"
44
#include "alloc.h"

cache-tree.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef CACHE_TREE_H
22
#define CACHE_TREE_H
33

4-
#include "cache.h"
54
#include "tree.h"
65
#include "tree-walk.h"
76

cache.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "pack-revindex.h"
1515
#include "hash.h"
1616
#include "path.h"
17+
#include "object.h"
1718
#include "oid-array.h"
1819
#include "repository.h"
1920
#include "mem-pool.h"
@@ -453,26 +454,6 @@ void prefetch_cache_entries(const struct index_state *istate,
453454
extern struct index_state the_index;
454455
#endif
455456

456-
#define TYPE_BITS 3
457-
458-
/*
459-
* Values in this enum (except those outside the 3 bit range) are part
460-
* of pack file format. See gitformat-pack(5) for more information.
461-
*/
462-
enum object_type {
463-
OBJ_BAD = -1,
464-
OBJ_NONE = 0,
465-
OBJ_COMMIT = 1,
466-
OBJ_TREE = 2,
467-
OBJ_BLOB = 3,
468-
OBJ_TAG = 4,
469-
/* 5 for future expansion */
470-
OBJ_OFS_DELTA = 6,
471-
OBJ_REF_DELTA = 7,
472-
OBJ_ANY,
473-
OBJ_MAX
474-
};
475-
476457
static inline enum object_type object_type(unsigned int mode)
477458
{
478459
return S_ISDIR(mode) ? OBJ_TREE :

diff-merges.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "git-compat-util.h"
22
#include "diff-merges.h"
33

4+
#include "gettext.h"
45
#include "revision.h"
56

67
typedef void (*diff_merges_setup_func_t)(struct rev_info *);

diff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "pathspec.h"
99
#include "object.h"
1010
#include "oidset.h"
11+
#include "strbuf.h"
1112

1213
/**
1314
* The diff API is for programs that compare two sets of files (e.g. two trees,
@@ -71,7 +72,6 @@ struct oid_array;
7172
struct option;
7273
struct repository;
7374
struct rev_info;
74-
struct strbuf;
7575
struct userdiff_driver;
7676

7777
typedef int (*pathchange_fn_t)(struct diff_options *options,

diffcore-delta.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 "diff.h"
33
#include "diffcore.h"
44

fsck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef GIT_FSCK_H
22
#define GIT_FSCK_H
33

4+
#include "object.h"
45
#include "oidset.h"
56

67
enum fsck_msg_type {

help.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "exec-cmd.h"
66
#include "run-command.h"
77
#include "levenshtein.h"
8+
#include "gettext.h"
89
#include "help.h"
910
#include "command-list.h"
1011
#include "string-list.h"

0 commit comments

Comments
 (0)