From 4b3f93b9bc4360bf1d85d38e077497affc096325 Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Fri, 26 Apr 2019 15:19:18 +0300 Subject: [PATCH] vcs: filter potentially ignored files in externally added files (IDEA-211694) GitOrigin-RevId: 631e2ba7a2b5cb23f39879faa5bdb6bd473df8d8 --- .../openapi/vcs/ExternallyAddedFilesProcessorImpl.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ExternallyAddedFilesProcessorImpl.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/ExternallyAddedFilesProcessorImpl.kt index 173c59f6c687..e403fbcd49ec 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ExternallyAddedFilesProcessorImpl.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ExternallyAddedFilesProcessorImpl.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vcs.changes.ChangeListListener import com.intellij.openapi.vcs.changes.ChangeListManagerImpl +import com.intellij.openapi.vcs.changes.VcsIgnoreManager import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent import com.intellij.openapi.vfs.newvfs.events.VFileEvent @@ -41,6 +42,8 @@ class ExternallyAddedFilesProcessorImpl(project: Project, private val vcsManager = ProjectLevelVcsManager.getInstance(project) + private val vcsIgnoreManager = VcsIgnoreManager.getInstance(project) + init { runReadAction { if (!project.isDisposed) { @@ -126,7 +129,11 @@ class ExternallyAddedFilesProcessorImpl(project: Project, } override fun doFilterFiles(files: Collection): Collection = - changeListManager.unversionedFiles.filter { isUnder(files, it) } + changeListManager.unversionedFiles + .asSequence() + .filterNot(vcsIgnoreManager::isPotentiallyIgnoredFile) + .filter { isUnder(files, it) } + .toSet() override fun rememberForAllProjects() {}