vcs: add registry option to process externally added files

This commit is contained in:
Dmitry Zhuravlev
2019-02-05 17:18:40 +03:00
parent 6a3a0b56c9
commit 1c4ebddb01
3 changed files with 7 additions and 1 deletions
@@ -509,6 +509,9 @@ vcs.code.analysis.before.checkin.show.only.new.threshold=-1
vcs.code.analysis.before.checkin.show.only.new.threshold.description=Show only newly introduced warnings and errors in results \
of before checkin analysis if the number of changed files is less or equals than threshold
vcs.process.externally.added.files=false
vcs.process.externally.added.files.description=Process externally added files. Add such files to VCS automatically or prompt user.
psi.incremental.reparse.depth.limit=1000
psi.deferIconLoading=true
@@ -11,6 +11,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.*;
@@ -96,7 +97,7 @@ public abstract class VcsVFSListener implements Disposable {
}
private static boolean isExternalEvent(@NotNull VirtualFileEvent event) {
return event.isFromRefresh();
return event.isFromRefresh() && Registry.is("vcs.process.externally.added.files");
}
private boolean isUnderMyVcs(@NotNull VirtualFile file) {
@@ -1,6 +1,7 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package git4idea.notification
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.vcs.VcsBundle
import com.intellij.openapi.vcs.VcsConfiguration
import com.intellij.openapi.vcs.VcsShowConfirmationOption
@@ -15,6 +16,7 @@ class GitExternalFileNotifierTest : GitSingleRepoTest() {
override fun setUp() {
super.setUp()
Registry.get("vcs.process.externally.added.files").setValue(true, testRootDisposable)
setStandardConfirmation(project, vcs.name, VcsConfiguration.StandardConfirmation.ADD, VcsShowConfirmationOption.Value.SHOW_CONFIRMATION)
projectRoot.children //ensure that all subsequent VFS events will be fired after new files added to projectRoot
}