test-lint: echo -e (or -E) is not portable
[git/debian.git] / repository.h
blob417787f3ef02e871406fa81d1a1bebcdac6e5f13
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;
47 * Path from the root of the top-level superproject down to this
48 * repository. This is only non-NULL if the repository is initialized
49 * as a submodule of another repository.
51 char *submodule_prefix;
53 /* Subsystems */
55 * Repository's config which contains key-value pairs from the usual
56 * set of config files (i.e. repo specific .git/config, user wide
57 * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
59 struct config_set *config;
61 /* Repository's submodule config as defined by '.gitmodules' */
62 struct submodule_cache *submodule_cache;
65 * Repository's in-memory index.
66 * 'repo_read_index()' can be used to populate 'index'.
68 struct index_state *index;
70 /* Configurations */
72 * Bit used during initialization to indicate if repository state (like
73 * the location of the 'objectdir') should be read from the
74 * environment. By default this bit will be set at the begining of
75 * 'repo_init()' so that all repositories will ignore the environment.
76 * The exception to this is 'the_repository', which doesn't go through
77 * the normal 'repo_init()' process.
79 unsigned ignore_env:1;
81 /* Indicate if a repository has a different 'commondir' from 'gitdir' */
82 unsigned different_commondir:1;
85 extern struct repository *the_repository;
87 extern void repo_set_gitdir(struct repository *repo, const char *path);
88 extern void repo_set_worktree(struct repository *repo, const char *path);
89 extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
90 extern int repo_submodule_init(struct repository *submodule,
91 struct repository *superproject,
92 const char *path);
93 extern void repo_clear(struct repository *repo);
95 extern int repo_read_index(struct repository *repo);
97 #endif /* REPOSITORY_H */