[vcs] IDEA-109608 Apply patch: Fix path detection for new files + test

The index returned by compareNamesImpl is better when it is smaller:
it means that more path components were matched,
when walking from the ends of compared paths.
This commit is contained in:
Kirill Likhodedov
2013-11-28 16:58:02 +04:00
parent 6a19297266
commit 9e88e3b2da
@@ -84,7 +84,7 @@ public class MatchPatchPaths {
for (VirtualFile file : files) {
Pair<VirtualFile, Integer> pair = compareNamesImpl(strings, file, i);
if (pair != null && pair.getSecond() < i) {
if (best == null || pair.getSecond() > best.getSecond()) {
if (best == null || pair.getSecond() < best.getSecond()) {
best = pair;
}
}