[vfs] fixes missed notifications on flat file watch root changes on macOS (IDEA-165018)

This commit is contained in:
Roman Shevchenko
2016-12-06 18:22:43 +01:00
parent 9b34ec993d
commit 22e1a27ca9
2 changed files with 12 additions and 14 deletions
@@ -144,7 +144,6 @@ class CanonicalPathMap {
String rootParent = new File(root).getParent();
if (rootParent != null && FileUtil.namesEqual(path, rootParent)) {
changedPaths.add(root);
continue ext;
}
}
}
@@ -158,7 +157,6 @@ class CanonicalPathMap {
String rootParent = new File(root).getParent();
if (rootParent != null && FileUtil.namesEqual(path, rootParent)) {
changedPaths.add(root);
continue ext;
}
}
}
@@ -119,23 +119,23 @@ class FileWatcherTest : BareTestFixtureTestCase() {
}
@Test fun testFileRoot() {
val file = tempDir.newFile("test.txt")
refresh(file)
val files = arrayOf(tempDir.newFile("test1.txt"), tempDir.newFile("test2.txt"))
files.forEach { refresh(it) }
files.forEach { watch(it, false) }
watch(file, false)
assertEvents({ file.writeText("new content") }, mapOf(file to 'U'))
assertEvents({ file.delete() }, mapOf(file to 'D'))
assertEvents({ file.writeText("re-creation") }, mapOf(file to 'C'))
assertEvents({ files.forEach { it.writeText("new content") } }, files.map { it to 'U' }.toMap())
assertEvents({ files.forEach { it.delete() } }, files.map { it to 'D' }.toMap())
assertEvents({ files.forEach { it.writeText("re-creation") } }, files.map { it to 'C' }.toMap())
}
@Test fun testFileRootRecursive() {
val file = tempDir.newFile("test.txt")
refresh(file)
val files = arrayOf(tempDir.newFile("test1.txt"), tempDir.newFile("test2.txt"))
files.forEach { refresh(it) }
files.forEach { watch(it, true) }
watch(file, true)
assertEvents({ file.writeText("new content") }, mapOf(file to 'U'))
assertEvents({ file.delete() }, mapOf(file to 'D'))
assertEvents({ file.writeText("re-creation") }, mapOf(file to 'C'))
assertEvents({ files.forEach { it.writeText("new content") } }, files.map { it to 'U' }.toMap())
assertEvents({ files.forEach { it.delete() } }, files.map { it to 'D' }.toMap())
assertEvents({ files.forEach { it.writeText("re-creation") } }, files.map { it to 'C' }.toMap())
}
@Test fun testNonCanonicallyNamedFileRoot() {