environment: store worktree in the_repository
[git/debian.git] / repository.h
blob0a1db9633f7b64f142e2314edae0d80622de8fda
1 #ifndef REPOSITORY_H
2 #define REPOSITORY_H
4 struct repository {
5 /* Environment */
6 /*
7 * Path to the git directory.
8 * Cannot be NULL after initialization.
9 */
10 char *gitdir;
13 * Path to the common git directory.
14 * Cannot be NULL after initialization.
16 char *commondir;
19 * Path to the repository's object store.
20 * Cannot be NULL after initialization.
22 char *objectdir;
25 * Path to the repository's graft file.
26 * Cannot be NULL after initialization.
28 char *graft_file;
31 * Path to the current worktree's index file.
32 * Cannot be NULL after initialization.
34 char *index_file;
37 * Path to the working directory.
38 * A NULL value indicates that there is no working directory.
40 char *worktree;
42 /* Configurations */
44 * Bit used during initialization to indicate if repository state (like
45 * the location of the 'objectdir') should be read from the
46 * environment. By default this bit will be set at the begining of
47 * 'repo_init()' so that all repositories will ignore the environment.
48 * The exception to this is 'the_repository', which doesn't go through
49 * the normal 'repo_init()' process.
51 unsigned ignore_env:1;
53 /* Indicate if a repository has a different 'commondir' from 'gitdir' */
54 unsigned different_commondir:1;
57 extern struct repository *the_repository;
59 extern void repo_set_gitdir(struct repository *repo, const char *path);
60 extern void repo_set_worktree(struct repository *repo, const char *path);
61 extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
62 extern void repo_clear(struct repository *repo);
64 #endif /* REPOSITORY_H */