diff options
author | Pierre-Olivier Latour <pol@mac.com> | 2015-06-15 11:14:40 -0700 |
---|---|---|
committer | Pierre-Olivier Latour <pol@mac.com> | 2015-06-23 07:48:26 -0700 |
commit | 8d8a2eefef0fbb42d7a7fb8f88ca7481515e2737 (patch) | |
tree | 20f301bf35e0e05fb0f99ce86637608f25775c8d /src/diff.c | |
parent | 0c34fa5094ba624ebe398d1b154fd27c207108cb (diff) | |
download | libgit2-8d8a2eefef0fbb42d7a7fb8f88ca7481515e2737.tar.gz |
Fixed GIT_DELTA_CONFLICTED not returned in some cases
If an index entry for a file that is not in HEAD is in conflicted state,
when diffing HEAD with the index, the status field of the corresponding git_diff_delta was incorrectly reported as GIT_DELTA_ADDED instead of GIT_DELTA_CONFLICTED.
This was due to handle_unmatched_new_item() initially setting the status
to GIT_DELTA_CONFLICTED but then overriding it later with GIT_DELTA_ADDED.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c index d7365ef77..e42ca63bb 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1089,8 +1089,10 @@ static int handle_unmatched_new_item( /* item contained in ignored directory, so skip over it */ return iterator_advance(&info->nitem, info->new_iter); - else if (info->new_iter->type != GIT_ITERATOR_TYPE_WORKDIR) - delta_type = GIT_DELTA_ADDED; + else if (info->new_iter->type != GIT_ITERATOR_TYPE_WORKDIR) { + if (delta_type != GIT_DELTA_CONFLICTED) + delta_type = GIT_DELTA_ADDED; + } else if (nitem->mode == GIT_FILEMODE_COMMIT) { /* ignore things that are not actual submodules */ |