summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-06-29 17:55:44 -0400
committerEdward Thomson <ethomson@github.com>2016-06-29 18:37:00 -0400
commit6249d960ab2d968acd1a9d87986c81a12e2e96bc (patch)
tree21d8d23bf8b67bee52619b136d45f592cd21cb74 /src/index.c
parent6f7ec7283db8c105f6c08d333783c4a99476eeee (diff)
downloadlibgit2-6249d960ab2d968acd1a9d87986c81a12e2e96bc.tar.gz
index: include conflicts in `git_index_read_index`ethomson/read_index_conflicts
Ensure that we include conflicts when calling `git_index_read_index`, which will remove conflicts in the index that do not exist in the new target, and will add conflicts from the new target.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/index.c b/src/index.c
index 94427b972..6546ea18a 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2952,7 +2952,8 @@ static int git_index_read_iterator(
else if (new_length_hint)
kh_resize(idx, new_entries_map, new_length_hint);
- opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+ opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE |
+ GIT_ITERATOR_INCLUDE_CONFLICTS;
if ((error = git_iterator_for_index(&index_iterator,
git_index_owner(index), index, &opts)) < 0 ||
@@ -3070,15 +3071,15 @@ int git_index_read_index(
git_iterator_options opts = GIT_ITERATOR_OPTIONS_INIT;
int error;
- opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
+ opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE |
+ GIT_ITERATOR_INCLUDE_CONFLICTS;
if ((error = git_iterator_for_index(&new_iterator,
- git_index_owner(new_index), (git_index *)new_index, &opts)) < 0)
+ git_index_owner(new_index), (git_index *)new_index, &opts)) < 0 ||
+ (error = git_index_read_iterator(index, new_iterator,
+ new_index->entries.length)) < 0)
goto done;
- error = git_index_read_iterator(index, new_iterator,
- new_index->entries.length);
-
done:
git_iterator_free(new_iterator);
return error;