diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2012-10-23 15:42:09 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2012-10-24 20:24:37 -0500 |
commit | 632d8b230bf38cc61cd70b55a54ae2f52502b4af (patch) | |
tree | 38a8c4825ab59511951b586edb434a5240f3dc9f /src/reset.c | |
parent | 6f6b0c013c6eff2aca2a7ada1027044f2e20f578 (diff) | |
download | libgit2-632d8b230bf38cc61cd70b55a54ae2f52502b4af.tar.gz |
reset changes for merge
Diffstat (limited to 'src/reset.c')
-rw-r--r-- | src/reset.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/reset.c b/src/reset.c index 560ae17b1..aff5b9f88 100644 --- a/src/reset.c +++ b/src/reset.c @@ -8,8 +8,10 @@ #include "common.h" #include "commit.h" #include "tag.h" +#include "merge.h" #include "git2/reset.h" #include "git2/checkout.h" +#include "git2/merge.h" #define ERROR_MSG "Cannot perform reset" @@ -88,6 +90,11 @@ int git_reset( goto cleanup; } + if (reset_type == GIT_RESET_SOFT && (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE)) { + giterr_set(GITERR_OBJECT, "%s (soft) while in the middle of a merge.", ERROR_MSG); + goto cleanup; + } + //TODO: Check for unmerged entries if (update_head(repo, commit) < 0) @@ -118,6 +125,11 @@ int git_reset( goto cleanup; } + if ((error = git_merge__cleanup(repo)) < 0) { + giterr_set(GITERR_INDEX, "%s - Failed to clean up merge data.", ERROR_MSG); + goto cleanup; + } + if (reset_type == GIT_RESET_MIXED) { error = 0; goto cleanup; |