diff --git a/platform/lvcs-impl/src/com/intellij/history/core/Paths.java b/platform/lvcs-impl/src/com/intellij/history/core/Paths.java index 46c4207530ea..440fd699ef7d 100644 --- a/platform/lvcs-impl/src/com/intellij/history/core/Paths.java +++ b/platform/lvcs-impl/src/com/intellij/history/core/Paths.java @@ -44,7 +44,6 @@ public class Paths { } public static String appended(String path, String child) { - if (path.length() == 0) return child; path = appendParent(path); return path + child; } @@ -82,6 +81,7 @@ public class Paths { } private static String appendParent(String parent) { + if (parent.isEmpty()) return parent; if (parent.charAt(parent.length() - 1) != DELIM) parent += DELIM; return parent; } diff --git a/platform/lvcs-impl/testSrc/com/intellij/history/core/PathsTest.java b/platform/lvcs-impl/testSrc/com/intellij/history/core/PathsTest.java index 31f0c2e347cc..32f5ec2eb16e 100644 --- a/platform/lvcs-impl/testSrc/com/intellij/history/core/PathsTest.java +++ b/platform/lvcs-impl/testSrc/com/intellij/history/core/PathsTest.java @@ -42,6 +42,8 @@ public class PathsTest extends LocalHistoryTestCase { assertEquals("c:/root/file", Paths.appended("c:/root", "file")); assertEquals("/foo", Paths.appended("/", "foo")); assertEquals("/foo/bar", Paths.appended("/foo", "bar")); + + assertEquals("bar", Paths.appended("", "bar")); } @Test @@ -79,6 +81,8 @@ public class PathsTest extends LocalHistoryTestCase { assertFalse(Paths.isParent("foo/bar", "foo/baz")); assertFalse(Paths.isParent("foo/bar", "foo/barr")); assertFalse(Paths.isParent("foo/bar", "foo/barr/baz")); + + assertTrue(Paths.isParent("", "foo")); } @Test