submodule-config: store the_submodule_cache in the_repository
[git/debian.git] / repository.h
blobc40738ceb8c7b7c1ff81741c6c66ae09e31992e7
1 #ifndef REPOSITORY_H
2 #define REPOSITORY_H
4 struct config_set;
5 struct index_state;
6 struct submodule_cache;
8 struct repository {
9 /* Environment */
11 * Path to the git directory.
12 * Cannot be NULL after initialization.
14 char *gitdir;
17 * Path to the common git directory.
18 * Cannot be NULL after initialization.
20 char *commondir;
23 * Path to the repository's object store.
24 * Cannot be NULL after initialization.
26 char *objectdir;
29 * Path to the repository's graft file.
30 * Cannot be NULL after initialization.
32 char *graft_file;
35 * Path to the current worktree's index file.
36 * Cannot be NULL after initialization.
38 char *index_file;
41 * Path to the working directory.
42 * A NULL value indicates that there is no working directory.
44 char *worktree;
46 /* Subsystems */
48 * Repository's config which contains key-value pairs from the usual
49 * set of config files (i.e. repo specific .git/config, user wide
50 * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
52 struct config_set *config;
54 /* Repository's submodule config as defined by '.gitmodules' */
55 struct submodule_cache *submodule_cache;
58 * Repository's in-memory index.
59 * 'repo_read_index()' can be used to populate 'index'.
61 struct index_state *index;
63 /* Configurations */
65 * Bit used during initialization to indicate if repository state (like
66 * the location of the 'objectdir') should be read from the
67 * environment. By default this bit will be set at the begining of
68 * 'repo_init()' so that all repositories will ignore the environment.
69 * The exception to this is 'the_repository', which doesn't go through
70 * the normal 'repo_init()' process.
72 unsigned ignore_env:1;
74 /* Indicate if a repository has a different 'commondir' from 'gitdir' */
75 unsigned different_commondir:1;
78 extern struct repository *the_repository;
80 extern void repo_set_gitdir(struct repository *repo, const char *path);
81 extern void repo_set_worktree(struct repository *repo, const char *path);
82 extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
83 extern void repo_clear(struct repository *repo);
85 extern int repo_read_index(struct repository *repo);
87 #endif /* REPOSITORY_H */