0a1db9633f7b64f142e2314edae0d80622de8fda
   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         */
  10        char *gitdir;
  11
  12        /*
  13         * Path to the common git directory.
  14         * Cannot be NULL after initialization.
  15         */
  16        char *commondir;
  17
  18        /*
  19         * Path to the repository's object store.
  20         * Cannot be NULL after initialization.
  21         */
  22        char *objectdir;
  23
  24        /*
  25         * Path to the repository's graft file.
  26         * Cannot be NULL after initialization.
  27         */
  28        char *graft_file;
  29
  30        /*
  31         * Path to the current worktree's index file.
  32         * Cannot be NULL after initialization.
  33         */
  34        char *index_file;
  35
  36        /*
  37         * Path to the working directory.
  38         * A NULL value indicates that there is no working directory.
  39         */
  40        char *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         */
  51        unsigned ignore_env:1;
  52
  53        /* Indicate if a repository has a different 'commondir' from 'gitdir' */
  54        unsigned different_commondir:1;
  55};
  56
  57extern struct repository *the_repository;
  58
  59extern void repo_set_gitdir(struct repository *repo, const char *path);
  60extern void repo_set_worktree(struct repository *repo, const char *path);
  61extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
  62extern void repo_clear(struct repository *repo);
  63
  64#endif /* REPOSITORY_H */