diff options
author | Vicent Marti <vicent@github.com> | 2014-02-04 05:57:25 -0800 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-02-04 05:57:25 -0800 |
commit | 7369ea8075fa112bbd4c13f06eeedeb2a4e47153 (patch) | |
tree | 033c0bd32863aecf7f4b7e006ea97ff251cfb6f3 /src | |
parent | 3b6a5bac20a9cb46cd29d74baf06cf8a8d1248fb (diff) | |
parent | dbfd83bc6567763e6c363c462e9dd0628eaf3fe6 (diff) | |
download | libgit2-7369ea8075fa112bbd4c13f06eeedeb2a4e47153.tar.gz |
Merge pull request #2096 from ethomson/merge
Corrections for merge working directory validation
Diffstat (limited to 'src')
-rw-r--r-- | src/merge.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/merge.c b/src/merge.c index 20cfc0e23..ac973efd0 100644 --- a/src/merge.c +++ b/src/merge.c @@ -2330,7 +2330,7 @@ done: static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_index *index_new, git_vector *merged_paths) { - git_tree *head_tree = NULL; + git_index *index_repo = NULL; git_diff *wd_diff_list = NULL; git_diff_options opts = GIT_DIFF_OPTIONS_INIT; int error = 0; @@ -2341,9 +2341,6 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED; - if ((error = git_repository_head_tree(&head_tree, repo)) < 0) - goto done; - /* Workdir changes may exist iff they do not conflict with changes that * will be applied by the merge (including conflicts). Ensure that there * are no changes in the workdir to these paths. @@ -2351,13 +2348,13 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde opts.pathspec.count = merged_paths->length; opts.pathspec.strings = (char **)merged_paths->contents; - if ((error = git_diff_tree_to_workdir(&wd_diff_list, repo, head_tree, &opts)) < 0) + if ((error = git_diff_index_to_workdir(&wd_diff_list, repo, index_repo, &opts)) < 0) goto done; *conflicts = wd_diff_list->deltas.length; done: - git_tree_free(head_tree); + git_index_free(index_repo); git_diff_free(wd_diff_list); return error; @@ -2400,7 +2397,7 @@ int git_merge__indexes(git_repository *repo, git_index *index_new) /* Remove removed items from the index */ git_vector_foreach(&paths, i, path) { - if ((e = git_index_get_bypath(index_new, path, 0)) == NULL) { + if (git_index_get_bypath(index_new, path, 0) == NULL) { if ((error = git_index_remove(index_repo, path, 0)) < 0 && error != GIT_ENOTFOUND) goto done; |