summaryrefslogtreecommitdiff
path: root/src/cherrypick.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-05-23 14:50:51 -0700
committerEdward Thomson <ethomson@edwardthomson.com>2014-07-01 17:32:15 -0400
commit967f5a76b1c89f1f93840407fd2afd1e8005dad6 (patch)
tree6f8c392d63aa0d7dc6e9a254cb37fdbecb7b9937 /src/cherrypick.c
parent1453bd20897d074a3f65d86f0d2bbb72ed23d071 (diff)
downloadlibgit2-967f5a76b1c89f1f93840407fd2afd1e8005dad6.tar.gz
git_checkout_index: checkout other indexes
git_checkout_index can now check out other git_index's (that are not necessarily the repository index). This allows checkout_index to use the repository's index for stat cache information instead of the index data being checked out. git_merge and friends now check out their indexes directly instead of trying to blend it into the running index.
Diffstat (limited to 'src/cherrypick.c')
-rw-r--r--src/cherrypick.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cherrypick.c b/src/cherrypick.c
index e02348a03..cdc0eaac2 100644
--- a/src/cherrypick.c
+++ b/src/cherrypick.c
@@ -171,7 +171,7 @@ int git_cherry_pick(
char commit_oidstr[GIT_OID_HEXSZ + 1];
const char *commit_msg, *commit_summary;
git_buf their_label = GIT_BUF_INIT;
- git_index *index_new = NULL, *index_repo = NULL;
+ git_index *index_new = NULL;
int error = 0;
assert(repo && commit);
@@ -196,12 +196,10 @@ int git_cherry_pick(
(error = git_repository_head(&our_ref, repo)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
(error = git_cherry_pick_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
- (error = git_merge__indexes(repo, index_new)) < 0 ||
- (error = git_repository_index(&index_repo, repo)) < 0 ||
- (error = git_merge__append_conflicts_to_merge_msg(repo, index_repo)) < 0 ||
- (error = git_checkout_index(repo, index_repo, &opts.checkout_opts)) < 0)
+ (error = git_merge__check_result(repo, index_new)) < 0 ||
+ (error = git_merge__append_conflicts_to_merge_msg(repo, index_new)) < 0 ||
+ (error = git_checkout_index(repo, index_new, &opts.checkout_opts)) < 0)
goto on_error;
-
goto done;
on_error:
@@ -209,7 +207,6 @@ on_error:
done:
git_index_free(index_new);
- git_index_free(index_repo);
git_commit_free(our_commit);
git_reference_free(our_ref);
git_buf_free(&their_label);