API updates for repository.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
diff --git a/include/git2/repository.h b/include/git2/repository.h
index f891e91..29bb986 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -29,11 +29,11 @@ GIT_BEGIN_DECL
* The method will automatically detect if 'path' is a normal
* or bare repository or fail is 'path' is neither.
*
- * @param repository pointer to the repo which will be opened
+ * @param out pointer to the repo which will be opened
* @param path the path to the repository
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *path);
+GIT_EXTERN(int) git_repository_open(git_repository **out, const char *path);
/**
* Create a "fake" repository to wrap an object database
@@ -42,11 +42,11 @@ GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *pat
* with the API when all you have is an object database. This doesn't
* have any paths associated with it, so use with care.
*
- * @param repository pointer to the repo
+ * @param out pointer to the repo
* @param odb the object database to wrap
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_repository_wrap_odb(git_repository **repository, git_odb *odb);
+GIT_EXTERN(int) git_repository_wrap_odb(git_repository **out, git_odb *odb);
/**
* Look for a git repository and copy its path in the given buffer.
@@ -58,10 +58,10 @@ GIT_EXTERN(int) git_repository_wrap_odb(git_repository **repository, git_odb *od
* The method will automatically detect if the repository is bare
* (if there is a repository).
*
- * @param repository_path The user allocated buffer which will
+ * @param path_out The user allocated buffer which will
* contain the found path.
*
- * @param size repository_path size
+ * @param path_size repository_path size
*
* @param start_path The base path where the lookup starts.
*
@@ -77,8 +77,8 @@ GIT_EXTERN(int) git_repository_wrap_odb(git_repository **repository, git_odb *od
* @return 0 or an error code
*/
GIT_EXTERN(int) git_repository_discover(
- char *repository_path,
- size_t size,
+ char *path_out,
+ size_t path_size,
const char *start_path,
int across_fs,
const char *ceiling_dirs);
@@ -95,18 +95,18 @@ GIT_EXTERN(int) git_repository_discover(
* directory "/home/user/source/" will not return "/.git/" as the found
* repo if "/" is a different filesystem than "/home".)
*/
-enum {
+typedef enum {
GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0),
GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1),
-};
+} git_repository_open_flags;
/**
* Find and open a repository with extended controls.
*
- * @param repo_out Pointer to the repo which will be opened. This can
+ * @param out Pointer to the repo which will be opened. This can
* actually be NULL if you only want to use the error code to
* see if a repo at this path could be opened.
- * @param start_path Path to open as git repository. If the flags
+ * @param path Path to open as git repository. If the flags
* permit "searching", then this can be a path to a subdirectory
* inside the working directory of the repository.
* @param flags A combination of the GIT_REPOSITORY_OPEN flags above.
@@ -118,9 +118,9 @@ enum {
* (such as repo corruption or system errors).
*/
GIT_EXTERN(int) git_repository_open_ext(
- git_repository **repo,
- const char *start_path,
- uint32_t flags,
+ git_repository **out,
+ const char *path,
+ unsigned int flags,
const char *ceiling_dirs);
/**
@@ -142,7 +142,7 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo);
* TODO:
* - Reinit the repository
*
- * @param repo_out pointer to the repo which will be created or reinitialized
+ * @param out pointer to the repo which will be created or reinitialized
* @param path the path to the repository
* @param is_bare if true, a Git repository without a working directory is
* created at the pointed path. If false, provided path will be
@@ -152,7 +152,7 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo);
* @return 0 or an error code
*/
GIT_EXTERN(int) git_repository_init(
- git_repository **repo_out,
+ git_repository **out,
const char *path,
unsigned is_bare);
@@ -238,7 +238,7 @@ enum {
* repository initialization is completed, an "origin" remote
* will be added pointing to this URL.
*/
-typedef struct {
+typedef struct git_repository_init_options {
uint32_t flags;
uint32_t mode;
const char *workdir_path;
@@ -256,26 +256,26 @@ typedef struct {
* auto-detect the case sensitivity of the file system and if the
* file system supports file mode bits correctly.
*
- * @param repo_out Pointer to the repo which will be created or reinitialized.
+ * @param out Pointer to the repo which will be created or reinitialized.
* @param repo_path The path to the repository.
* @param opts Pointer to git_repository_init_options struct.
* @return 0 or an error code on failure.
*/
GIT_EXTERN(int) git_repository_init_ext(
- git_repository **repo_out,
+ git_repository **out,
const char *repo_path,
git_repository_init_options *opts);
/**
* Retrieve and resolve the reference pointed at by HEAD.
*
- * @param head_out pointer to the reference which will be retrieved
+ * @param out pointer to the reference which will be retrieved
* @param repo a repository object
*
* @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
* branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
*/
-GIT_EXTERN(int) git_repository_head(git_reference **head_out, git_repository *repo);
+GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
/**
* Check if a repository's HEAD is detached
@@ -468,12 +468,12 @@ GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index
* Use this function to get the contents of this file. Don't forget to
* remove the file after you create the commit.
*
- * @param buffer Buffer to write data into or NULL to just read required size
+ * @param out Buffer to write data into or NULL to just read required size
* @param len Length of buffer in bytes
* @param repo Repository to read prepared message from
* @return Bytes written to buffer, GIT_ENOTFOUND if no message, or -1 on error
*/
-GIT_EXTERN(int) git_repository_message(char *buffer, size_t len, git_repository *repo);
+GIT_EXTERN(int) git_repository_message(char *out, size_t len, git_repository *repo);
/**
* Remove git's prepared message.
diff --git a/src/repository.c b/src/repository.c
index efbb3a3..b49b49b 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -361,7 +361,7 @@ static int find_repo(
int git_repository_open_ext(
git_repository **repo_ptr,
const char *start_path,
- uint32_t flags,
+ unsigned int flags,
const char *ceiling_dirs)
{
int error;
@@ -1162,14 +1162,14 @@ int git_repository_init(
}
int git_repository_init_ext(
- git_repository **repo_out,
+ git_repository **out,
const char *given_repo,
git_repository_init_options *opts)
{
int error;
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT;
- assert(repo_out && given_repo && opts);
+ assert(out && given_repo && opts);
error = repo_init_directories(&repo_path, &wd_path, given_repo, opts);
if (error < 0)
@@ -1202,10 +1202,10 @@ int git_repository_init_ext(
if (error < 0)
goto cleanup;
- error = git_repository_open(repo_out, git_buf_cstr(&repo_path));
+ error = git_repository_open(out, git_buf_cstr(&repo_path));
if (!error && opts->origin_url)
- error = repo_init_create_origin(*repo_out, opts->origin_url);
+ error = repo_init_create_origin(*out, opts->origin_url);
cleanup:
git_buf_free(&repo_path);