1#ifndef REPOSITORY_H 2#define REPOSITORY_H 3 4struct repository { 5/* Environment */ 6/* 7 * Path to the git directory. 8 * Cannot be NULL after initialization. 9 */ 10char*gitdir; 11 12/* 13 * Path to the common git directory. 14 * Cannot be NULL after initialization. 15 */ 16char*commondir; 17 18/* 19 * Path to the repository's object store. 20 * Cannot be NULL after initialization. 21 */ 22char*objectdir; 23 24/* 25 * Path to the repository's graft file. 26 * Cannot be NULL after initialization. 27 */ 28char*graft_file; 29 30/* 31 * Path to the current worktree's index file. 32 * Cannot be NULL after initialization. 33 */ 34char*index_file; 35 36/* 37 * Path to the working directory. 38 * A NULL value indicates that there is no working directory. 39 */ 40char*worktree; 41 42/* Configurations */ 43/* 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. 50 */ 51unsigned ignore_env:1; 52 53/* Indicate if a repository has a different 'commondir' from 'gitdir' */ 54unsigned different_commondir:1; 55}; 56 57externstruct repository *the_repository; 58 59externvoidrepo_set_gitdir(struct repository *repo,const char*path); 60externvoidrepo_set_worktree(struct repository *repo,const char*path); 61externintrepo_init(struct repository *repo,const char*gitdir,const char*worktree); 62externvoidrepo_clear(struct repository *repo); 63 64#endif/* REPOSITORY_H */