repository.hon commit t7001: add test case for --dry-run (36b78cd)
   1#ifndef REPOSITORY_H
   2#define REPOSITORY_H
   3
   4struct config_set;
   5struct index_state;
   6struct submodule_cache;
   7
   8struct repository {
   9        /* Environment */
  10        /*
  11         * Path to the git directory.
  12         * Cannot be NULL after initialization.
  13         */
  14        char *gitdir;
  15
  16        /*
  17         * Path to the common git directory.
  18         * Cannot be NULL after initialization.
  19         */
  20        char *commondir;
  21
  22        /*
  23         * Path to the repository's object store.
  24         * Cannot be NULL after initialization.
  25         */
  26        char *objectdir;
  27
  28        /*
  29         * Path to the repository's graft file.
  30         * Cannot be NULL after initialization.
  31         */
  32        char *graft_file;
  33
  34        /*
  35         * Path to the current worktree's index file.
  36         * Cannot be NULL after initialization.
  37         */
  38        char *index_file;
  39
  40        /*
  41         * Path to the working directory.
  42         * A NULL value indicates that there is no working directory.
  43         */
  44        char *worktree;
  45
  46        /*
  47         * Path from the root of the top-level superproject down to this
  48         * repository.  This is only non-NULL if the repository is initialized
  49         * as a submodule of another repository.
  50         */
  51        char *submodule_prefix;
  52
  53        /* Subsystems */
  54        /*
  55         * Repository's config which contains key-value pairs from the usual
  56         * set of config files (i.e. repo specific .git/config, user wide
  57         * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
  58         */
  59        struct config_set *config;
  60
  61        /* Repository's submodule config as defined by '.gitmodules' */
  62        struct submodule_cache *submodule_cache;
  63
  64        /*
  65         * Repository's in-memory index.
  66         * 'repo_read_index()' can be used to populate 'index'.
  67         */
  68        struct index_state *index;
  69
  70        /* Configurations */
  71        /*
  72         * Bit used during initialization to indicate if repository state (like
  73         * the location of the 'objectdir') should be read from the
  74         * environment.  By default this bit will be set at the begining of
  75         * 'repo_init()' so that all repositories will ignore the environment.
  76         * The exception to this is 'the_repository', which doesn't go through
  77         * the normal 'repo_init()' process.
  78         */
  79        unsigned ignore_env:1;
  80
  81        /* Indicate if a repository has a different 'commondir' from 'gitdir' */
  82        unsigned different_commondir:1;
  83};
  84
  85extern struct repository *the_repository;
  86
  87extern void repo_set_gitdir(struct repository *repo, const char *path);
  88extern void repo_set_worktree(struct repository *repo, const char *path);
  89extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
  90extern int repo_submodule_init(struct repository *submodule,
  91                               struct repository *superproject,
  92                               const char *path);
  93extern void repo_clear(struct repository *repo);
  94
  95extern int repo_read_index(struct repository *repo);
  96
  97#endif /* REPOSITORY_H */