summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre-Olivier Latour <pol@mac.com>2015-06-17 08:55:09 -0700
committerPierre-Olivier Latour <pol@mac.com>2015-06-22 21:37:41 -0700
commitcb63e7e8971134e41e99a7010d9b2ad54e6639ff (patch)
treea8fde7d90bac3c3c578534c54a5c01da65019286 /src
parent91c1833af1bdc0680b42e9f2934665330f826c18 (diff)
downloadlibgit2-cb63e7e8971134e41e99a7010d9b2ad54e6639ff.tar.gz
Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge()
This fixes a bug where if a file was in conflicted state in either diff, it would not always remain in conflicted state in the merged diff.
Diffstat (limited to 'src')
-rw-r--r--src/diff_tform.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 03dd9c9f7..041592fbf 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -65,6 +65,12 @@ static git_diff_delta *diff_delta__merge_like_cgit(
* f3 = b->new_file
*/
+ /* If one of the diffs is a conflict, just dup it */
+ if (b->status == GIT_DELTA_CONFLICTED)
+ return diff_delta__dup(b, pool);
+ if (a->status == GIT_DELTA_CONFLICTED)
+ return diff_delta__dup(a, pool);
+
/* if f2 == f3 or f2 is deleted, then just dup the 'a' diff */
if (b->status == GIT_DELTA_UNMODIFIED || a->status == GIT_DELTA_DELETED)
return diff_delta__dup(a, pool);
@@ -111,6 +117,11 @@ static git_diff_delta *diff_delta__merge_like_cgit_reversed(
/* reversed version of above logic */
+ if (a->status == GIT_DELTA_CONFLICTED)
+ return diff_delta__dup(a, pool);
+ if (b->status == GIT_DELTA_CONFLICTED)
+ return diff_delta__dup(b, pool);
+
if (a->status == GIT_DELTA_UNMODIFIED)
return diff_delta__dup(b, pool);