repository.hon commit remote: force completing --mirror= instead of --mirror (ebc4a04)
   1#ifndef REPOSITORY_H
   2#define REPOSITORY_H
   3
   4struct config_set;
   5struct index_state;
   6struct submodule_cache;
   7struct git_hash_algo;
   8
   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
  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
  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
  62        /* Repository's submodule config as defined by '.gitmodules' */
  63        struct submodule_cache *submodule_cache;
  64
  65        /*
  66         * Repository's in-memory index.
  67         * 'repo_read_index()' can be used to populate 'index'.
  68         */
  69        struct index_state *index;
  70
  71        /* Repository's current hash algorithm, as serialized on disk. */
  72        const struct git_hash_algo *hash_algo;
  73
  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
  91extern void repo_set_gitdir(struct repository *repo, const char *path);
  92extern void repo_set_worktree(struct repository *repo, const char *path);
  93extern void repo_set_hash_algo(struct repository *repo, int algo);
  94extern int repo_init(struct repository *repo, const char *gitdir, const char *worktree);
  95extern int repo_submodule_init(struct repository *submodule,
  96                               struct repository *superproject,
  97                               const char *path);
  98extern void repo_clear(struct repository *repo);
  99
 100/*
 101 * Populates the repository's index from its index_file, an index struct will
 102 * be allocated if needed.
 103 *
 104 * Return the number of index entries in the populated index or a value less
 105 * than zero if an error occured.  If the repository's index has already been
 106 * populated then the number of entries will simply be returned.
 107 */
 108extern int repo_read_index(struct repository *repo);
 109
 110#endif /* REPOSITORY_H */