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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b5fa608180
commit
a64215b6cd
2
alloc.c
2
alloc.c
@ -8,7 +8,7 @@
|
|||||||
* up with maximal alignment because it doesn't know what the object alignment
|
* up with maximal alignment because it doesn't know what the object alignment
|
||||||
* for the new allocation is.
|
* for the new allocation is.
|
||||||
*/
|
*/
|
||||||
#include "cache.h"
|
#include "git-compat-util.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
|
1
blame.h
1
blame.h
@ -1,7 +1,6 @@
|
|||||||
#ifndef BLAME_H
|
#ifndef BLAME_H
|
||||||
#define BLAME_H
|
#define BLAME_H
|
||||||
|
|
||||||
#include "cache.h"
|
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "xdiff-interface.h"
|
#include "xdiff-interface.h"
|
||||||
#include "revision.h"
|
#include "revision.h"
|
||||||
|
2
blob.c
2
blob.c
@ -1,4 +1,4 @@
|
|||||||
#include "cache.h"
|
#include "git-compat-util.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef CACHE_TREE_H
|
#ifndef CACHE_TREE_H
|
||||||
#define CACHE_TREE_H
|
#define CACHE_TREE_H
|
||||||
|
|
||||||
#include "cache.h"
|
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "tree-walk.h"
|
#include "tree-walk.h"
|
||||||
|
|
||||||
|
21
cache.h
21
cache.h
@ -14,6 +14,7 @@
|
|||||||
#include "pack-revindex.h"
|
#include "pack-revindex.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
#include "object.h"
|
||||||
#include "oid-array.h"
|
#include "oid-array.h"
|
||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "mem-pool.h"
|
#include "mem-pool.h"
|
||||||
@ -453,26 +454,6 @@ void prefetch_cache_entries(const struct index_state *istate,
|
|||||||
extern struct index_state the_index;
|
extern struct index_state the_index;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TYPE_BITS 3
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Values in this enum (except those outside the 3 bit range) are part
|
|
||||||
* of pack file format. See gitformat-pack(5) for more information.
|
|
||||||
*/
|
|
||||||
enum object_type {
|
|
||||||
OBJ_BAD = -1,
|
|
||||||
OBJ_NONE = 0,
|
|
||||||
OBJ_COMMIT = 1,
|
|
||||||
OBJ_TREE = 2,
|
|
||||||
OBJ_BLOB = 3,
|
|
||||||
OBJ_TAG = 4,
|
|
||||||
/* 5 for future expansion */
|
|
||||||
OBJ_OFS_DELTA = 6,
|
|
||||||
OBJ_REF_DELTA = 7,
|
|
||||||
OBJ_ANY,
|
|
||||||
OBJ_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline enum object_type object_type(unsigned int mode)
|
static inline enum object_type object_type(unsigned int mode)
|
||||||
{
|
{
|
||||||
return S_ISDIR(mode) ? OBJ_TREE :
|
return S_ISDIR(mode) ? OBJ_TREE :
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "diff-merges.h"
|
#include "diff-merges.h"
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
#include "revision.h"
|
#include "revision.h"
|
||||||
|
|
||||||
typedef void (*diff_merges_setup_func_t)(struct rev_info *);
|
typedef void (*diff_merges_setup_func_t)(struct rev_info *);
|
||||||
|
2
diff.h
2
diff.h
@ -8,6 +8,7 @@
|
|||||||
#include "pathspec.h"
|
#include "pathspec.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "oidset.h"
|
#include "oidset.h"
|
||||||
|
#include "strbuf.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The diff API is for programs that compare two sets of files (e.g. two trees,
|
* The diff API is for programs that compare two sets of files (e.g. two trees,
|
||||||
@ -71,7 +72,6 @@ struct oid_array;
|
|||||||
struct option;
|
struct option;
|
||||||
struct repository;
|
struct repository;
|
||||||
struct rev_info;
|
struct rev_info;
|
||||||
struct strbuf;
|
|
||||||
struct userdiff_driver;
|
struct userdiff_driver;
|
||||||
|
|
||||||
typedef int (*pathchange_fn_t)(struct diff_options *options,
|
typedef int (*pathchange_fn_t)(struct diff_options *options,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "cache.h"
|
#include "git-compat-util.h"
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
#include "diffcore.h"
|
#include "diffcore.h"
|
||||||
|
|
||||||
|
1
fsck.h
1
fsck.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef GIT_FSCK_H
|
#ifndef GIT_FSCK_H
|
||||||
#define GIT_FSCK_H
|
#define GIT_FSCK_H
|
||||||
|
|
||||||
|
#include "object.h"
|
||||||
#include "oidset.h"
|
#include "oidset.h"
|
||||||
|
|
||||||
enum fsck_msg_type {
|
enum fsck_msg_type {
|
||||||
|
1
help.c
1
help.c
@ -5,6 +5,7 @@
|
|||||||
#include "exec-cmd.h"
|
#include "exec-cmd.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
#include "levenshtein.h"
|
#include "levenshtein.h"
|
||||||
|
#include "gettext.h"
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
#include "command-list.h"
|
#include "command-list.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
|
#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
|
||||||
#define LIST_OBJECTS_FILTER_OPTIONS_H
|
#define LIST_OBJECTS_FILTER_OPTIONS_H
|
||||||
|
|
||||||
#include "cache.h"
|
#include "object.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
#include "strbuf.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The list of defined filters for list-objects.
|
* The list of defined filters for list-objects.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "cache.h"
|
#include "git-compat-util.h"
|
||||||
#include "noop.h"
|
#include "noop.h"
|
||||||
#include "../commit.h"
|
#include "../commit.h"
|
||||||
#include "../fetch-negotiator.h"
|
#include "../fetch-negotiator.h"
|
||||||
|
22
object.h
22
object.h
@ -1,7 +1,7 @@
|
|||||||
#ifndef OBJECT_H
|
#ifndef OBJECT_H
|
||||||
#define OBJECT_H
|
#define OBJECT_H
|
||||||
|
|
||||||
#include "cache.h"
|
#include "hash.h"
|
||||||
|
|
||||||
struct buffer_slab;
|
struct buffer_slab;
|
||||||
|
|
||||||
@ -81,6 +81,26 @@ struct object_array {
|
|||||||
*/
|
*/
|
||||||
#define FLAG_BITS 28
|
#define FLAG_BITS 28
|
||||||
|
|
||||||
|
#define TYPE_BITS 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Values in this enum (except those outside the 3 bit range) are part
|
||||||
|
* of pack file format. See gitformat-pack(5) for more information.
|
||||||
|
*/
|
||||||
|
enum object_type {
|
||||||
|
OBJ_BAD = -1,
|
||||||
|
OBJ_NONE = 0,
|
||||||
|
OBJ_COMMIT = 1,
|
||||||
|
OBJ_TREE = 2,
|
||||||
|
OBJ_BLOB = 3,
|
||||||
|
OBJ_TAG = 4,
|
||||||
|
/* 5 for future expansion */
|
||||||
|
OBJ_OFS_DELTA = 6,
|
||||||
|
OBJ_REF_DELTA = 7,
|
||||||
|
OBJ_ANY,
|
||||||
|
OBJ_MAX
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The object type is stored in 3 bits.
|
* The object type is stored in 3 bits.
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
|
|
||||||
|
struct oid_array;
|
||||||
|
|
||||||
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
|
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
|
||||||
int register_shallow(struct repository *r, const struct object_id *oid);
|
int register_shallow(struct repository *r, const struct object_id *oid);
|
||||||
int unregister_shallow(const struct object_id *oid);
|
int unregister_shallow(const struct object_id *oid);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "git-compat-util.h"
|
#include "cache.h"
|
||||||
#include "bloom.h"
|
#include "bloom.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "test-tool.h"
|
#include "test-tool.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "test-tool.h"
|
#include "test-tool.h"
|
||||||
#include "cache.h"
|
#include "git-compat-util.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "decorate.h"
|
#include "decorate.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef WORKTREE_H
|
#ifndef WORKTREE_H
|
||||||
#define WORKTREE_H
|
#define WORKTREE_H
|
||||||
|
|
||||||
#include "cache.h"
|
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
|
||||||
struct strbuf;
|
struct strbuf;
|
||||||
|
Loading…
Reference in New Issue
Block a user