From 8d8a2eefef0fbb42d7a7fb8f88ca7481515e2737 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Latour Date: Mon, 15 Jun 2015 11:14:40 -0700 Subject: 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. --- src/diff.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/diff.c') 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 */ -- cgit v1.2.1