Commit 50456801 by Pierre-Olivier Latour

Fixed handling of GIT_DELTA_CONFLICTED in git_diff_find_similar()

git_diff_find_similar() now ignores git_diff_delta records with a status
of GIT_DELTA_CONFLICTED, which fixes a crash due to assert() being hit.
parent da6720fc
...@@ -676,11 +676,13 @@ static bool is_rename_target( ...@@ -676,11 +676,13 @@ static bool is_rename_target(
return false; return false;
/* only consider ADDED, RENAMED, COPIED, and split MODIFIED as /* only consider ADDED, RENAMED, COPIED, and split MODIFIED as
* targets; maybe include UNTRACKED and IGNORED if requested. * targets; maybe include UNTRACKED if requested.
*/ */
switch (delta->status) { switch (delta->status) {
case GIT_DELTA_UNMODIFIED: case GIT_DELTA_UNMODIFIED:
case GIT_DELTA_DELETED: case GIT_DELTA_DELETED:
case GIT_DELTA_IGNORED:
case GIT_DELTA_CONFLICTED:
return false; return false;
case GIT_DELTA_MODIFIED: case GIT_DELTA_MODIFIED:
...@@ -707,9 +709,6 @@ static bool is_rename_target( ...@@ -707,9 +709,6 @@ static bool is_rename_target(
return false; return false;
break; break;
case GIT_DELTA_IGNORED:
return false;
default: /* all other status values should be checked */ default: /* all other status values should be checked */
break; break;
} }
...@@ -735,6 +734,7 @@ static bool is_rename_source( ...@@ -735,6 +734,7 @@ static bool is_rename_source(
case GIT_DELTA_UNTRACKED: case GIT_DELTA_UNTRACKED:
case GIT_DELTA_UNREADABLE: case GIT_DELTA_UNREADABLE:
case GIT_DELTA_IGNORED: case GIT_DELTA_IGNORED:
case GIT_DELTA_CONFLICTED:
return false; return false;
case GIT_DELTA_DELETED: case GIT_DELTA_DELETED:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment