summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorMatthew Bowen <matthew@mgbowen.com>2014-03-05 21:49:23 -0500
committerMatthew Bowen <matthew@mgbowen.com>2014-03-05 21:49:23 -0500
commitb9f819978c571cc806827e8b3ebc1a58a0755999 (patch)
tree64c94ef334360b064a3bdf9b6069c1422f727150 /src/checkout.c
parenta064dc2d0b6206116a35be4b62c58c3c1170d5de (diff)
downloadlibgit2-b9f819978c571cc806827e8b3ebc1a58a0755999.tar.gz
Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 72fe5368f..4ef8da076 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2194,3 +2194,15 @@ int git_checkout_head(
assert(repo);
return git_checkout_tree(repo, NULL, opts);
}
+
+int git_checkout_init_opts(git_checkout_opts* opts, int version)
+{
+ if (version != GIT_CHECKOUT_OPTS_VERSION) {
+ giterr_set(GITERR_INVALID, "Invalid version %d for git_checkout_opts", version);
+ return -1;
+ } else {
+ git_checkout_opts o = GIT_CHECKOUT_OPTS_INIT;
+ memcpy(opts, &o, sizeof(o));
+ return 0;
+ }
+}