repository.c: delete dead functions
[git/git.git] / repository.h
CommitLineData
359efeff
BW
1#ifndef REPOSITORY_H
2#define REPOSITORY_H
3
3b256228 4struct config_set;
639e30b5 5struct index_state;
bf12fcdf 6struct submodule_cache;
78a67668 7struct git_hash_algo;
3b256228 8
359efeff
BW
9struct repository {
10 /* Environment */
11 /*
12 * Path to the git directory.
13 * Cannot be NULL after initialization.
14 */
15 char *gitdir;
16
17 /*
18 * Path to the common git directory.
19 * Cannot be NULL after initialization.
20 */
21 char *commondir;
22
23 /*
24 * Path to the repository's object store.
25 * Cannot be NULL after initialization.
26 */
27 char *objectdir;
28
29 /*
30 * Path to the repository's graft file.
31 * Cannot be NULL after initialization.
32 */
33 char *graft_file;
34
35 /*
36 * Path to the current worktree's index file.
37 * Cannot be NULL after initialization.
38 */
39 char *index_file;
40
41 /*
42 * Path to the working directory.
43 * A NULL value indicates that there is no working directory.
44 */
45 char *worktree;
46
96dc883b
BW
47 /*
48 * Path from the root of the top-level superproject down to this
49 * repository. This is only non-NULL if the repository is initialized
50 * as a submodule of another repository.
51 */
52 char *submodule_prefix;
53
3b256228
BW
54 /* Subsystems */
55 /*
56 * Repository's config which contains key-value pairs from the usual
57 * set of config files (i.e. repo specific .git/config, user wide
58 * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
59 */
60 struct config_set *config;
61
bf12fcdf
BW
62 /* Repository's submodule config as defined by '.gitmodules' */
63 struct submodule_cache *submodule_cache;
64
639e30b5
BW
65 /*
66 * Repository's in-memory index.
67 * 'repo_read_index()' can be used to populate 'index'.
68 */
69 struct index_state *index;
70
78a67668 71 /* Repository's current hash algorithm, as serialized on disk. */
72 const struct git_hash_algo *hash_algo;
73
359efeff
BW
74 /* Configurations */
75 /*
76 * Bit used during initialization to indicate if repository state (like
77 * the location of the 'objectdir') should be read from the
78 * environment. By default this bit will be set at the begining of
79 * 'repo_init()' so that all repositories will ignore the environment.
80 * The exception to this is 'the_repository', which doesn't go through
81 * the normal 'repo_init()' process.
82 */
83 unsigned ignore_env:1;
84
85 /* Indicate if a repository has a different 'commondir' from 'gitdir' */
86 unsigned different_commondir:1;
87};
88
89extern struct repository *the_repository;
90
357a03eb
NTND
91struct set_gitdir_args {
92 const char *commondir;
93 const char *object_dir;
94 const char *graft_file;
95 const char *index_file;
96};
97
98extern void repo_set_gitdir(struct repository *repo,
99 const char *root,
100 const struct set_gitdir_args *optional);
359efeff 101extern void repo_set_worktree(struct repository *repo, const char *path);
78a67668 102extern void repo_set_hash_algo(struct repository *repo, int algo);
b2f0ecee 103extern void initialize_the_repository(void);
96dc883b
BW
104extern int repo_submodule_init(struct repository *submodule,
105 struct repository *superproject,
106 const char *path);
359efeff
BW
107extern void repo_clear(struct repository *repo);
108
3f138775
BW
109/*
110 * Populates the repository's index from its index_file, an index struct will
111 * be allocated if needed.
112 *
113 * Return the number of index entries in the populated index or a value less
114 * than zero if an error occured. If the repository's index has already been
115 * populated then the number of entries will simply be returned.
116 */
639e30b5
BW
117extern int repo_read_index(struct repository *repo);
118
359efeff 119#endif /* REPOSITORY_H */