diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-09-06 15:15:46 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-09-17 10:48:30 +0200 |
commit | c214fa1caff937f20ca3a388652352cda92ce85b (patch) | |
tree | 95e4b878cb2d0aeb13e18a830b192f0b366c9246 /src/reset.c | |
parent | 020cda99c2bec386cb10200f6cfe1b150911ffc9 (diff) | |
download | libgit2-c214fa1caff937f20ca3a388652352cda92ce85b.tar.gz |
checkout: segregate checkout strategies
Diffstat (limited to 'src/reset.c')
-rw-r--r-- | src/reset.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/reset.c b/src/reset.c index efe3b6be9..4ce21e2cf 100644 --- a/src/reset.c +++ b/src/reset.c @@ -28,6 +28,7 @@ int git_reset( git_index *index = NULL; git_tree *tree = NULL; int error = -1; + git_checkout_opts opts; assert(repo && target); assert(reset_type == GIT_RESET_SOFT @@ -81,7 +82,13 @@ int git_reset( goto cleanup; } - if (git_checkout_index(repo, NULL, NULL, NULL) < 0) { + memset(&opts, 0, sizeof(opts)); + opts.checkout_strategy = + GIT_CHECKOUT_CREATE_MISSING + | GIT_CHECKOUT_OVERWRITE_MODIFIED + | GIT_CHECKOUT_REMOVE_UNTRACKED; + + if (git_checkout_index(repo, &opts, NULL) < 0) { giterr_set(GITERR_INDEX, "%s - Failed to checkout the index.", ERROR_MSG); goto cleanup; } |