From 9e88e3b2da916884bd2a9cdcca697666957dae01 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 28 Nov 2013 16:57:13 +0400 Subject: [PATCH] [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. --- .../com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java index 7f8b2e821d7a..5dee17f3abb0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java @@ -84,7 +84,7 @@ public class MatchPatchPaths { for (VirtualFile file : files) { Pair 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; } }