]> git.proxmox.com Git - libgit2.git/commitdiff
API updates for repository.h
authorBen Straub <bs@github.com>
Tue, 27 Nov 2012 21:44:49 +0000 (13:44 -0800)
committerBen Straub <bs@github.com>
Tue, 27 Nov 2012 21:44:49 +0000 (13:44 -0800)
include/git2/repository.h
src/repository.c

index f891e91e9d0fe15b94a7327653a6e3b7d8dce8eb..29bb9863f30c82a70bea4bdd7f6f99c68e9ca4c2 100644 (file)
@@ -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.
index efbb3a348c31c0a3599f757dd3668c9641aacfc6..b49b49b7a5776d00e9efb3aee90cb3ecf16b1bf3 100644 (file)
@@ -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);