diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java index 4f4efe5137a3..4b057f49b282 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java @@ -21,7 +21,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.StorageScheme; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ex.ProjectEx; @@ -35,7 +34,6 @@ import com.intellij.openapi.vcs.changes.FilePathUnderVcs; import com.intellij.openapi.vcs.changes.VcsGuess; import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; import com.intellij.openapi.vcs.impl.projectlevelman.NewMappings; -import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; @@ -102,10 +100,7 @@ public class ModuleDefaultVcsRootPolicy extends DefaultVcsRootPolicy { if (matchContext != null) { return true; } - if (myBaseDir != null && VfsUtilCore.isAncestor(myBaseDir, file, false)) { - return !ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(file); - } - return false; + return myBaseDir != null && VfsUtilCore.isAncestor(myBaseDir, file, false); } @Override diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java index de1a40d80f36..f6fa3148afe7 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java @@ -53,17 +53,17 @@ public class NewMappings { private final DefaultVcsRootPolicy myDefaultVcsRootPolicy; private final MessageBus myMessageBus; private final FileStatusManager myFileStatusManager; - private final FileIndexFacade myExcludedFileIndex; + private final FileIndexFacade myFileIndexFacade; private final Project myProject; private boolean myActivated; public NewMappings(final Project project, final MessageBus messageBus, - final ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager, FileIndexFacade excludedFileIndex) { + final ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager, FileIndexFacade fileIndexFacade) { myProject = project; myMessageBus = messageBus; myFileStatusManager = fileStatusManager; - myExcludedFileIndex = excludedFileIndex; + myFileIndexFacade = fileIndexFacade; myLock = new Object(); myVcsToPaths = new HashMap>(); myFileWatchRequestsManager = new FileWatchRequestsManager(myProject, this, LocalFileSystem.getInstance()); @@ -232,7 +232,12 @@ public class NewMappings { } @Nullable - public VcsDirectoryMapping getMappingFor(final VirtualFile file, final Object matchContext) { + public VcsDirectoryMapping getMappingFor(final VirtualFile file, final Object parentModule) { + // if parentModule is not null it means that file belongs to the module so it isn't excluded + if (parentModule == null && myFileIndexFacade.isExcludedFile(file)) { + return null; + } + // performance: calculate file path just once, rather than once per mapping String path = file.getPath(); final String systemIndependentPath = FileUtil.toSystemIndependentName((file.isDirectory() && (! path.endsWith("/"))) ? (path + "/") : path); @@ -242,7 +247,7 @@ public class NewMappings { } for (int i = mappings.length - 1; i >= 0; -- i) { final VcsDirectoryMapping mapping = mappings[i]; - if (fileMatchesMapping(file, matchContext, systemIndependentPath, mapping)) { + if (fileMatchesMapping(file, parentModule, systemIndependentPath, mapping)) { return mapping; } } @@ -262,8 +267,7 @@ public class NewMappings { if (mapping.getDirectory().length() == 0) { return myDefaultVcsRootPolicy.matchesDefaultMapping(file, matchContext); } - return FileUtil.startsWith(systemIndependentPath, mapping.systemIndependentPath()) && - ! myExcludedFileIndex.isExcludedFile(file); + return FileUtil.startsWith(systemIndependentPath, mapping.systemIndependentPath()); } public List getMappingsAsFilesUnderVcs(final AbstractVcs vcs) {