vcs-ignore: check ignored but not excluded directories only on full ignore holders rescan

This will avoid the proposal of some directories which was created inside already ignored dirs

GitOrigin-RevId: 263c4adc232e2ae0bc4612fb11220d7cb663bc1e
This commit is contained in:
Dmitry Zhuravlev
2019-06-14 13:32:30 +03:00
committed by intellij-monorepo-bot
parent 9cdf4b2e36
commit fcaf3191e8
5 changed files with 9 additions and 8 deletions
@@ -11,6 +11,6 @@ public interface VcsIgnoredHolderUpdateListener extends EventListener {
default void updateStarted() {}
default void updateFinished(@NotNull Collection<FilePath> ignoredPaths) {}
default void updateFinished(@NotNull Collection<FilePath> ignoredPaths, boolean isFullRescan) {}
}
@@ -90,8 +90,9 @@ class IgnoredToExcludedSynchronizer(project: Project, parentDisposable: Disposab
override fun needDoForCurrentProject() = VcsConfiguration.getInstance(project).MARK_IGNORED_AS_EXCLUDED
override fun updateFinished(ignoredPaths: Collection<FilePath>) {
override fun updateFinished(ignoredPaths: Collection<FilePath>, isFullRescan: Boolean) {
ProgressManager.checkCanceled()
if (!isFullRescan) return
if (!Registry.`is`("vcs.propose.add.ignored.directories.to.exclude", true)) return
if (!VcsConfiguration.getInstance(project).MARK_IGNORED_AS_EXCLUDED && wasAskedBefore()) return
@@ -156,7 +156,7 @@ abstract class VcsRepositoryIgnoredFilesHolderBase<REPOSITORY : Repository>(
fireUpdateStarted()
val ignored = action()
inUpdateMode.set(false)
fireUpdateFinished(ignored)
fireUpdateFinished(ignored, isFullRescan)
doAfterRescan?.run()
}
})
@@ -197,8 +197,8 @@ abstract class VcsRepositoryIgnoredFilesHolderBase<REPOSITORY : Repository>(
listeners.multicaster.updateStarted()
}
private fun fireUpdateFinished(paths: Collection<FilePath>) {
listeners.multicaster.updateFinished(paths)
private fun fireUpdateFinished(paths: Collection<FilePath>, isFullRescan: Boolean) {
listeners.multicaster.updateFinished(paths, isFullRescan)
}
private fun isUnder(parents: Set<VirtualFile>, child: VirtualFile) = generateSequence(child) { it.parent }.any { it in parents }
@@ -213,7 +213,7 @@ abstract class VcsRepositoryIgnoredFilesHolderBase<REPOSITORY : Repository>(
addUpdateStateListener(this)
}
override fun updateFinished(ignoredPaths: Collection<FilePath>) = awaitLatch.countDown()
override fun updateFinished(ignoredPaths: Collection<FilePath>, isFullRescan: Boolean) = awaitLatch.countDown()
fun waitFor() {
awaitLatch.await()
@@ -308,7 +308,7 @@ public class GitRepositoryImpl extends RepositoryImpl implements GitRepository {
}
@Override
public void updateFinished(@NotNull Collection<FilePath> ignoredPaths) {
public void updateFinished(@NotNull Collection<FilePath> ignoredPaths, boolean isFullRescan) {
if(myProject.isDisposed()) return;
myChangesViewI.scheduleRefresh();
@@ -269,7 +269,7 @@ public class HgRepositoryImpl extends RepositoryImpl implements HgRepository {
}
@Override
public void updateFinished(@NotNull Collection<FilePath> ignoredPaths) {
public void updateFinished(@NotNull Collection<FilePath> ignoredPaths, boolean isFullRescan) {
if(myProject.isDisposed()) return;
myChangesViewI.scheduleRefresh();