diff options
author | Matthew Bowen <matthew@mgbowen.com> | 2014-03-05 21:49:23 -0500 |
---|---|---|
committer | Matthew Bowen <matthew@mgbowen.com> | 2014-03-05 21:49:23 -0500 |
commit | b9f819978c571cc806827e8b3ebc1a58a0755999 (patch) | |
tree | 64c94ef334360b064a3bdf9b6069c1422f727150 /include/git2 | |
parent | a064dc2d0b6206116a35be4b62c58c3c1170d5de (diff) | |
download | libgit2-b9f819978c571cc806827e8b3ebc1a58a0755999.tar.gz |
Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/blame.h | 13 | ||||
-rw-r--r-- | include/git2/checkout.h | 13 | ||||
-rw-r--r-- | include/git2/clone.h | 13 | ||||
-rw-r--r-- | include/git2/diff.h | 26 | ||||
-rw-r--r-- | include/git2/merge.h | 24 | ||||
-rw-r--r-- | include/git2/push.h | 13 | ||||
-rw-r--r-- | include/git2/remote.h | 13 | ||||
-rw-r--r-- | include/git2/repository.h | 13 | ||||
-rw-r--r-- | include/git2/revert.h | 13 | ||||
-rw-r--r-- | include/git2/status.h | 13 | ||||
-rw-r--r-- | include/git2/sys/config.h | 13 | ||||
-rw-r--r-- | include/git2/sys/odb_backend.h | 13 | ||||
-rw-r--r-- | include/git2/sys/refdb_backend.h | 13 | ||||
-rw-r--r-- | include/git2/transport.h | 13 |
14 files changed, 206 insertions, 0 deletions
diff --git a/include/git2/blame.h b/include/git2/blame.h index 4ad51ee50..b7fa9aeda 100644 --- a/include/git2/blame.h +++ b/include/git2/blame.h @@ -83,6 +83,19 @@ typedef struct git_blame_options { #define GIT_BLAME_OPTIONS_INIT {GIT_BLAME_OPTIONS_VERSION} /** +* Initializes a `git_blame_options` with default values. Equivalent to +* creating an instance with GIT_BLAME_OPTIONS_INIT. +* +* @param opts the `git_blame_options` instance to initialize. +* @param version the version of the struct; you should pass +* `GIT_BLAME_OPTIONS_VERSION` here. +* @return Zero on success; -1 on failure. +*/ +GIT_EXTERN(int) git_blame_init_options( + git_blame_options* opts, + int version); + +/** * Structure that represents a blame hunk. * * - `lines_in_hunk` is the number of lines in this hunk diff --git a/include/git2/checkout.h b/include/git2/checkout.h index 0faf4ab14..702e088d9 100644 --- a/include/git2/checkout.h +++ b/include/git2/checkout.h @@ -267,6 +267,19 @@ typedef struct git_checkout_opts { #define GIT_CHECKOUT_OPTS_INIT {GIT_CHECKOUT_OPTS_VERSION} /** +* Initializes a `git_checkout_opts` with default values. Equivalent to +* creating an instance with GIT_CHECKOUT_OPTS_INIT. +* +* @param opts the `git_checkout_opts` instance to initialize. +* @param version the version of the struct; you should pass +* `GIT_CHECKOUT_OPTS_VERSION` here. +* @return Zero on success; -1 on failure. +*/ +GIT_EXTERN(int) git_checkout_init_opts( + git_checkout_opts* opts, + int version); + +/** * Updates files in the index and the working tree to match the content of * the commit pointed at by HEAD. * diff --git a/include/git2/clone.h b/include/git2/clone.h index 3e885d103..98c6fb7d7 100644 --- a/include/git2/clone.h +++ b/include/git2/clone.h @@ -66,6 +66,19 @@ typedef struct git_clone_options { #define GIT_CLONE_OPTIONS_INIT {GIT_CLONE_OPTIONS_VERSION, {GIT_CHECKOUT_OPTS_VERSION, GIT_CHECKOUT_SAFE_CREATE}, GIT_REMOTE_CALLBACKS_INIT} /** +* Initializes a `git_clone_options` with default values. Equivalent to +* creating an instance with GIT_CLONE_OPTIONS_INIT. +* +* @param opts the `git_clone_options` instance to initialize. +* @param version the version of the struct; you should pass +* `GIT_CLONE_OPTIONS_VERSION` here. +* @return Zero on success; -1 on failure. +*/ +GIT_EXTERN(int) git_clone_init_options( + git_clone_options* opts, + int version); + +/** * Clone a remote repository. * * This version handles the simple case. If you'd like to create the diff --git a/include/git2/diff.h b/include/git2/diff.h index 943e2ec4c..f855f52ba 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -377,6 +377,19 @@ typedef struct { {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_DEFAULT, {NULL,0}, NULL, NULL, 3} /** +* Initializes a `git_diff_options` with default values. Equivalent to +* creating an instance with GIT_DIFF_OPTIONS_INIT. +* +* @param opts the `git_diff_options` instance to initialize. +* @param version the version of the struct; you should pass +* `GIT_DIFF_OPTIONS_VERSION` here. +* @return Zero on success; -1 on failure. +*/ +GIT_EXTERN(int) git_diff_init_options( + git_diff_options* opts, + int version); + +/** * When iterating over a diff, callback that will be made per file. * * @param delta A pointer to the delta data for the file @@ -604,6 +617,19 @@ typedef struct { #define GIT_DIFF_FIND_OPTIONS_VERSION 1 #define GIT_DIFF_FIND_OPTIONS_INIT {GIT_DIFF_FIND_OPTIONS_VERSION} +/** +* Initializes a `git_diff_find_options` with default values. Equivalent to +* creating an instance with GIT_DIFF_FIND_OPTIONS_INIT. +* +* @param opts the `git_diff_find_options` instance to initialize. +* @param version the version of the struct; you should pass +* `GIT_DIFF_FIND_OPTIONS_VERSION` here. +* @return Zero on success; -1 on failure. +*/ +GIT_EXTERN(int) git_diff_find_init_options( + git_diff_find_options* opts, + int version); + /** @name Diff Generator Functions * * These are the functions you would use to create (or destroy) a diff --git a/include/git2/merge.h b/include/git2/merge.h index b45d0fd5e..dc89a0482 100644 --- a/include/git2/merge.h +++ b/include/git2/merge.h @@ -104,6 +104,18 @@ typedef struct { #define GIT_MERGE_TREE_OPTS_VERSION 1 #define GIT_MERGE_TREE_OPTS_INIT {GIT_MERGE_TREE_OPTS_VERSION} +/** + * Initializes a `git_merge_tree_opts` with default values. Equivalent to + * creating an instance with GIT_MERGE_TREE_OPTS_INIT. + * + * @param opts the `git_merge_tree_opts` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_MERGE_TREE_OPTS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_merge_tree_init_opts( + git_merge_tree_opts* opts, + int version); /** * Option flags for `git_merge`. @@ -144,6 +156,18 @@ typedef struct { #define GIT_MERGE_OPTS_VERSION 1 #define GIT_MERGE_OPTS_INIT {GIT_MERGE_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT} +/** + * Initializes a `git_merge_opts` with default values. Equivalent to creating + * an instance with GIT_MERGE_OPTS_INIT. + * + * @param opts the `git_merge_opts` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_MERGE_OPTS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_merge_init_opts( + git_merge_opts* opts, + int version); /** * Find a merge base between two commits diff --git a/include/git2/push.h b/include/git2/push.h index 67702aca2..899d21e7f 100644 --- a/include/git2/push.h +++ b/include/git2/push.h @@ -39,6 +39,19 @@ typedef struct { #define GIT_PUSH_OPTIONS_VERSION 1 #define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION } +/** + * Initializes a `git_push_options` with default values. Equivalent to + * creating an instance with GIT_PUSH_OPTIONS_INIT. + * + * @param opts the `git_push_options` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_PUSH_OPTIONS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_push_init_options( + git_push_options* opts, + int version); + /** Push network progress notification function */ typedef int (*git_push_transfer_progress)( unsigned int current, diff --git a/include/git2/remote.h b/include/git2/remote.h index 238b6fd4f..82a46acd1 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -495,6 +495,19 @@ struct git_remote_callbacks { #define GIT_REMOTE_CALLBACKS_INIT {GIT_REMOTE_CALLBACKS_VERSION} /** + * Initializes a `git_remote_callbacks` with default values. Equivalent to + * creating an instance with GIT_REMOTE_CALLBACKS_INIT. + * + * @param opts the `git_remote_callbacks` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_REMOTE_CALLBACKS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_remote_init_callbacks( + git_remote_callbacks* opts, + int version); + +/** * Set the callbacks for a remote * * Note that the remote keeps its own copy of the data and you need to diff --git a/include/git2/repository.h b/include/git2/repository.h index bf12c7a69..4433e71a2 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -268,6 +268,19 @@ typedef struct { #define GIT_REPOSITORY_INIT_OPTIONS_INIT {GIT_REPOSITORY_INIT_OPTIONS_VERSION} /** + * Initializes a `git_repository_init_options` with default values. Equivalent + * to creating an instance with GIT_REPOSITORY_INIT_OPTIONS_INIT. + * + * @param opts the `git_repository_init_options` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_REPOSITORY_INIT_OPTIONS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_repository_init_init_options( + git_repository_init_options* opts, + int version); + +/** * Create a new Git repository in the given folder with extended controls. * * This will initialize a new git repository (creating the repo_path diff --git a/include/git2/revert.h b/include/git2/revert.h index 86a6e26cb..088bda94d 100644 --- a/include/git2/revert.h +++ b/include/git2/revert.h @@ -34,6 +34,19 @@ typedef struct { #define GIT_REVERT_OPTS_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT} /** + * Initializes a `git_revert_opts` with default values. Equivalent to + * creating an instance with GIT_REVERT_OPTS_INIT. + * + * @param opts the `git_revert_opts` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_REVERT_OPTS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_revert_init_opts( + git_revert_opts* opts, + int version); + +/** * Reverts the given commit against the given "our" commit, producing an * index that reflects the result of the revert. * diff --git a/include/git2/status.h b/include/git2/status.h index aa68c0da0..84918456a 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -175,6 +175,19 @@ typedef struct { #define GIT_STATUS_OPTIONS_INIT {GIT_STATUS_OPTIONS_VERSION} /** + * Initializes a `git_status_options` with default values. Equivalent to + * creating an instance with GIT_STATUS_OPTIONS_INIT. + * + * @param opts the `git_status_options` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_STATUS_OPTIONS_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_status_init_options( + git_status_options* opts, + int version); + +/** * A status entry, providing the differences between the file as it exists * in HEAD and the index, and providing the differences between the index * and the working directory. diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 419ad7ea7..3df2ba327 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -70,6 +70,19 @@ struct git_config_backend { #define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION} /** + * Initializes a `git_config_backend` with default values. Equivalent to + * creating an instance with GIT_CONFIG_BACKEND_INIT. + * + * @param opts the `git_config_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_CONFIG_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_config_init_backend( + git_config_backend* backend, + int version); + +/** * Add a generic config file instance to an existing config * * Note that the configuration object will free the file diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index 4917ba0f0..81bb082e6 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -89,6 +89,19 @@ struct git_odb_backend { #define GIT_ODB_BACKEND_VERSION 1 #define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION} +/** + * Initializes a `git_odb_backend` with default values. Equivalent to + * creating an instance with GIT_ODB_BACKEND_INIT. + * + * @param opts the `git_odb_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_ODB_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_odb_init_backend( + git_odb_backend* backend, + int version); + GIT_EXTERN(void *) git_odb_backend_malloc(git_odb_backend *backend, size_t len); GIT_END_DECL diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index aa5ef9ecc..dce142c77 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -159,6 +159,19 @@ struct git_refdb_backend { #define GIT_REFDB_BACKEND_INIT {GIT_REFDB_BACKEND_VERSION} /** + * Initializes a `git_refdb_backend` with default values. Equivalent to + * creating an instance with GIT_REFDB_BACKEND_INIT. + * + * @param opts the `git_refdb_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_REFDB_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_refdb_init_backend( + git_refdb_backend* backend, + int version); + +/** * Constructors for default filesystem-based refdb backend * * Under normal usage, this is called for you when the repository is diff --git a/include/git2/transport.h b/include/git2/transport.h index 039321088..f2b0c630d 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -280,6 +280,19 @@ struct git_transport { #define GIT_TRANSPORT_INIT {GIT_TRANSPORT_VERSION} /** + * Initializes a `git_transport` with default values. Equivalent to + * creating an instance with GIT_TRANSPORT_INIT. + * + * @param opts the `git_transport` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_TRANSPORT_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_transport_init( + git_transport* opts, + int version); + +/** * Function to use to create a transport from a URL. The transport database * is scanned to find a transport that implements the scheme of the URI (i.e. * git:// or http://) and a transport object is returned to the caller. |