repository.hon commit config: read config from a repository object (3b25622)
   1#ifndef REPOSITORY_H
   2#define REPOSITORY_H
   3
   4struct config_set;
   5
   6struct repository {
   7        /* Environment */
   8        /*
   9         * Path to the git directory.
  10         * Cannot be NULL after initialization.
  11         */
  12        char *gitdir;
  13
  14        /*
  15         * Path to the common git directory.
  16         * Cannot be NULL after initialization.
  17         */
  18        char *commondir;
  19
  20        /*
  21         * Path to the repository's object store.
  22         * Cannot be NULL after initialization.
  23         */
  24        char *objectdir;
  25
  26        /*
  27         * Path to the repository's graft file.
  28         * Cannot be NULL after initialization.
  29         */
  30        char *graft_file;
  31
  32        /*
  33         * Path to the current worktree's index file.
  34         * Cannot be NULL after initialization.
  35         */
  36        char *index_file;
  37
  38        /*
  39         * Path to the working directory.
  40         * A NULL value indicates that there is no working directory.
  41         */
  42        char *worktree;
  43
  44        /* Subsystems */
  45        /*
  46         * Repository's config which contains key-value pairs from the usual
  47         * set of config files (i.e. repo specific .git/config, user wide
  48         * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
  49         */
  50        struct config_set *config;
  51
  52        /* Configurations */
  53        /*
  54         * Bit used during initialization to indicate if repository state (like
  55         * the location of the 'objectdir') should be read from the
  56         * environment.  By default this bit will be set at the begining of
  57         * 'repo_init()' so that all repositories will ignore the environment.
  58         * The exception to this is 'the_repository', which doesn't go through
  59         * the normal 'repo_init()' process.
  60         */
  61        unsigned ignore_env:1;
  62
  63        /* Indicate if a repository has a different 'commondir' from 'gitdir' */
  64        unsigned different_commondir:1;
  65};
  66
  67extern struct repository *the_repository;
  68
  69extern void repo_set_gitdir(struct repository *repo, const char *path);
  70extern void repo_set_worktree(struct repository *repo, const char *path);
  71extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
  72extern void repo_clear(struct repository *repo);
  73
  74#endif /* REPOSITORY_H */