* 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
* 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.
* 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.
*
* @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);
* 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.
* (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);
/**
* 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
* @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);
* 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;
* 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
* 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.
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;
}
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)
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);