diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index fddd22423c1b..6e49b73b3f65 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -300,6 +300,8 @@ vcs.log.labels.redesign=false vcs.log.labels.redesign.description=Show branch labels on the right with combined tag icons, do not display tag names, combine tracked branches, display detached heads with an exclamation mark vcs.log.highlight.not.indexed=false vcs.log.highlight.not.indexed.description=Highlight commits that are not indexed +vcs.log.index.git=false +vcs.log.index.git.description=Index all commits in Git repository for fast search vcs.executable.validator.timeout.sec=60 vcs.unversioned.files.in.commit=true diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java index 51e63b9b5902..caf064c515da 100644 --- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java +++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java @@ -27,6 +27,7 @@ public class VcsLogProperties { } @NotNull public static final VcsLogProperty LIGHTWEIGHT_BRANCHES = new VcsLogProperty<>(false); + @NotNull public static final VcsLogProperty SUPPORTS_INDEXING = new VcsLogProperty<>(false); @NotNull public static T get(@NotNull VcsLogProvider provider, VcsLogProperty property) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java index a9d1dc329dc3..5c2f7ef926bc 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java @@ -86,7 +86,13 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable { myProject = project; myProviders = providers; myFatalErrorsConsumer = fatalErrorsConsumer; - myRoots = providers.keySet(); + myRoots = ContainerUtil.newLinkedHashSet(); + + for (Map.Entry entry : providers.entrySet()) { + if (VcsLogProperties.get(entry.getValue(), VcsLogProperties.SUPPORTS_INDEXING)) { + myRoots.add(entry.getKey()); + } + } myUserRegistry = (VcsUserRegistryImpl)ServiceManager.getService(myProject, VcsUserRegistry.class); @@ -194,12 +200,12 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable { @Override public synchronized boolean isIndexed(@NotNull VirtualFile root) { - return !myCommitsToIndex.containsKey(root) && myNumberOfTasks.get(root).get() == 0; + return myRoots.contains(root) && (!myCommitsToIndex.containsKey(root) && myNumberOfTasks.get(root).get() == 0); } @Override public synchronized void markForIndexing(int index, @NotNull VirtualFile root) { - if (isIndexed(index)) return; + if (isIndexed(index) || !myRoots.contains(root)) return; TIntHashSet set = myCommitsToIndex.get(root); if (set == null) { set = new TIntHashSet(); diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java index 235200dec7de..764fde935284 100644 --- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java +++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java @@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.ThrowableNotNullFunction; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; @@ -518,12 +519,16 @@ public class GitLogProvider implements VcsLogProvider { return currentBranchName; } + @SuppressWarnings("unchecked") @Nullable @Override public T getPropertyValue(VcsLogProperties.VcsLogProperty property) { if (property == VcsLogProperties.LIGHTWEIGHT_BRANCHES) { return (T)Boolean.TRUE; } + else if (property == VcsLogProperties.SUPPORTS_INDEXING) { + return (T)Boolean.valueOf(Registry.is("vcs.log.index.git")); + } return null; }