summaryrefslogtreecommitdiff
path: root/include/git2/submodule.h
diff options
context:
space:
mode:
authorDavid Calavera <david.calavera@gmail.com>2015-01-06 13:49:39 -0800
committerEdward Thomson <ethomson@microsoft.com>2015-01-07 09:04:49 -0600
commitc868981f0eb1af20d62c1287dad3f8c94addf999 (patch)
tree8cff80cde401ffe4fff1e75c544d39be3ec2779c /include/git2/submodule.h
parent6a6c24e01638df91d9104e07d6ff5deaa7cb1574 (diff)
downloadlibgit2-c868981f0eb1af20d62c1287dad3f8c94addf999.tar.gz
Add extern function to initialize submodule update options.
Diffstat (limited to 'include/git2/submodule.h')
-rw-r--r--include/git2/submodule.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 31c68e3b9..f03ea2da8 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -110,9 +110,10 @@ typedef enum {
/**
* Submodule update options structure
*
- * Use the GIT_SUBMODULE_UPDATE_OPTIONS_INIT to get the default settings, like this:
+ * Use the GIT_SUBMODULE_UPDATE_OPTIONS_INIT to get the default settings,
+ * like this:
*
- * git_submodule_update_options opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
+ * git_submodule_update_options opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
*/
typedef struct git_submodule_update_options {
unsigned int version;
@@ -149,7 +150,21 @@ typedef struct git_submodule_update_options {
} git_submodule_update_options;
#define GIT_SUBMODULE_UPDATE_OPTIONS_VERSION 1
-#define GIT_SUBMODULE_UPDATE_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}, GIT_REMOTE_CALLBACKS_INIT, GIT_CHECKOUT_SAFE_CREATE}
+#define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
+ { GIT_CHECKOUT_OPTIONS_VERSION, \
+ { GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}, \
+ GIT_REMOTE_CALLBACKS_INIT, GIT_CHECKOUT_SAFE_CREATE }
+
+/**
+ * Initializes a `git_submodule_update_options` with default values.
+ * Equivalent to creating an instance with GIT_SUBMODULE_UPDATE_OPTIONS_INIT.
+ *
+ * @param opts The `git_submodule_update_options` instance to initialize.
+ * @param version Version of struct; pass `GIT_SUBMODULE_UPDATE_OPTIONS_VERSION`
+ * @return Zero on success; -1 on failure.
+ */
+GIT_EXTERN(int) git_submodule_update_init_options(
+ git_submodule_update_options *opts, unsigned int version);
/**
* Update a submodule. This will clone a missing submodule and