1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 module libgit2_d.sys.repository; 8 9 10 private static import libgit2_d.types; 11 12 /** 13 * @file git2/sys/repository.h 14 * @brief Git repository custom implementation routines 15 * @defgroup git_backend Git custom backend APIs 16 * @ingroup Git 17 * @{ 18 */ 19 extern (C): 20 nothrow @nogc: 21 package(libgit2_d): 22 23 /** 24 * Create a new repository with neither backends nor config object 25 * 26 * Note that this is only useful if you wish to associate the repository 27 * with a non-filesystem-backed object database and config store. 28 * 29 * Caveats: since this repository has no physical location, some systems 30 * can fail to function properly: locations under $GIT_DIR, $GIT_COMMON_DIR, 31 * or $GIT_INFO_DIR are impacted. 32 * 33 * Params: 34 * out_ = The blank repository 35 * 36 * Returns: 0 on success, or an error code 37 */ 38 //GIT_EXTERN 39 int git_repository_new(libgit2_d.types.git_repository** out_); 40 41 /** 42 * Reset all the internal state in a repository. 43 * 44 * This will free all the mapped memory and internal objects 45 * of the repository and leave it in a "blank" state. 46 * 47 * There's no need to call this function directly unless you're 48 * trying to aggressively cleanup the repo before its 49 * deallocation. `git_repository_free` already performs this operation 50 * before deallocating the repo. 51 * 52 * Params: 53 * repo = The repository to clean up 54 * 55 * Returns: 0 on success, or an error code 56 */ 57 //GIT_EXTERN 58 int git_repository__cleanup(libgit2_d.types.git_repository* repo); 59 60 /** 61 * Update the filesystem config settings for an open repository 62 * 63 * When a repository is initialized, config values are set based on the 64 * properties of the filesystem that the repository is on, such as 65 * "core.ignorecase", "core.filemode", "core.symlinks", etc. If the 66 * repository is moved to a new filesystem, these properties may no 67 * longer be correct and API calls may not behave as expected. This 68 * call reruns the phase of repository initialization that sets those 69 * properties to compensate for the current filesystem of the repo. 70 * 71 * Params: 72 * repo = A repository object 73 * recurse_submodules = Should submodules be updated recursively 74 * 75 * Returns: 0 on success, < 0 on error 76 */ 77 //GIT_EXTERN 78 int git_repository_reinit_filesystem(libgit2_d.types.git_repository* repo, int recurse_submodules); 79 80 /** 81 * Set the configuration file for this repository 82 * 83 * This configuration file will be used for all configuration 84 * queries involving this repository. 85 * 86 * The repository will keep a reference to the config file; 87 * the user must still free the config after setting it 88 * to the repository, or it will leak. 89 * 90 * Params: 91 * repo = A repository object 92 * config = A Config object 93 * 94 * Returns: 0 on success, or an error code 95 */ 96 //GIT_EXTERN 97 int git_repository_set_config(libgit2_d.types.git_repository* repo, libgit2_d.types.git_config* config); 98 99 /** 100 * Set the Object Database for this repository 101 * 102 * The ODB will be used for all object-related operations 103 * involving this repository. 104 * 105 * The repository will keep a reference to the ODB; the user 106 * must still free the ODB object after setting it to the 107 * repository, or it will leak. 108 * 109 * Params: 110 * repo = A repository object 111 * odb = An ODB object 112 * 113 * Returns: 0 on success, or an error code 114 */ 115 //GIT_EXTERN 116 int git_repository_set_odb(libgit2_d.types.git_repository* repo, libgit2_d.types.git_odb* odb); 117 118 /** 119 * Set the Reference Database Backend for this repository 120 * 121 * The refdb will be used for all reference related operations 122 * involving this repository. 123 * 124 * The repository will keep a reference to the refdb; the user 125 * must still free the refdb object after setting it to the 126 * repository, or it will leak. 127 * 128 * Params: 129 * repo = A repository object 130 * refdb = An refdb object 131 * 132 * Returns: 0 on success, or an error code 133 */ 134 //GIT_EXTERN 135 int git_repository_set_refdb(libgit2_d.types.git_repository* repo, libgit2_d.types.git_refdb* refdb); 136 137 /** 138 * Set the index file for this repository 139 * 140 * This index will be used for all index-related operations 141 * involving this repository. 142 * 143 * The repository will keep a reference to the index file; 144 * the user must still free the index after setting it 145 * to the repository, or it will leak. 146 * 147 * Params: 148 * repo = A repository object 149 * index = An index object 150 * 151 * Returns: 0 on success, or an error code 152 */ 153 //GIT_EXTERN 154 int git_repository_set_index(libgit2_d.types.git_repository* repo, libgit2_d.types.git_index* index); 155 156 /** 157 * Set a repository to be bare. 158 * 159 * Clear the working directory and set core.bare to true. You may also 160 * want to call `git_repository_set_index(repo, null)` since a bare repo 161 * typically does not have an index, but this function will not do that 162 * for you. 163 * 164 * Params: 165 * repo = Repo to make bare 166 * 167 * Returns: 0 on success, <0 on failure 168 */ 169 //GIT_EXTERN 170 int git_repository_set_bare(libgit2_d.types.git_repository* repo); 171 172 /** 173 * Load and cache all submodules. 174 * 175 * Because the `.gitmodules` file is unstructured, loading submodules is an 176 * O(N) operation. Any operation (such as `git_rebase_init`) that requires 177 * accessing all submodules is O(N^2) in the number of submodules, if it 178 * has to look each one up individually. This function loads all submodules 179 * and caches them so that subsequent calls to `git_submodule_lookup` are O(1). 180 * 181 * Params: 182 * repo = the repository whose submodules will be cached. 183 */ 184 //GIT_EXTERN 185 int git_repository_submodule_cache_all(libgit2_d.types.git_repository* repo); 186 187 /** 188 * Clear the submodule cache. 189 * 190 * Clear the submodule cache populated by `git_repository_submodule_cache_all`. 191 * If there is no cache, do nothing. 192 * 193 * The cache incorporates data from the repository's configuration, as well 194 * as the state of the working tree, the index, and HEAD. So any time any 195 * of these has changed, the cache might become invalid. 196 * 197 * Params: 198 * repo = the repository whose submodule cache will be cleared 199 */ 200 //GIT_EXTERN 201 int git_repository_submodule_cache_clear(libgit2_d.types.git_repository* repo); 202 203 /** @} */