private void update() {
    boolean nothingToDo;
    @Nullable List<FilePath> dirtyFiles;
    synchronized (LOCK) {
      nothingToDo = !isDirty();
      if (nothingToDo) myInUpdate = false;

      dirtyFiles = myEverythingDirty ? null : new ArrayList<>(myDirtyFiles);
      myDirtyFiles.clear();
      myEverythingDirty = false;
    }
    if (nothingToDo) {
      BackgroundTaskUtil.syncPublisher(myProject, VcsManagedFilesHolder.TOPIC).updatingModeChanged();
      return;
    }

    BackgroundTaskUtil.syncPublisher(myProject, GitRefreshListener.TOPIC).progressStarted();
    try {
      boolean everythingDirty = dirtyFiles == null || dirtyFiles.contains(VcsUtil.getFilePath(myRoot));
      StructuredIdeActivity activity = GitRefreshUsageCollector.logUntrackedRefresh(myProject, everythingDirty);
      RefreshResult result = refreshFiles(dirtyFiles);
      activity.finished();

      removePathsUnderOtherRoots(result.untracked, "unversioned");
      removePathsUnderOtherRoots(result.ignored, "ignored");

      RecursiveFilePathSet dirtyScope = null;
      if (dirtyFiles != null) {
        dirtyScope = new RecursiveFilePathSet(myRoot.isCaseSensitive());
        dirtyScope.addAll(dirtyFiles);
      }

      Set<FilePath> oldIgnored;
      List<FilePath> newIgnored;
      synchronized (LOCK) {
        oldIgnored = new HashSet<>(myIgnoredFiles.filePaths());
        applyRefreshResult(result, dirtyScope, oldIgnored);
        newIgnored = new ArrayList<>(myIgnoredFiles.filePaths());

        myInUpdate = isDirty();
      }

      BackgroundTaskUtil.syncPublisher(myProject, GitRefreshListener.TOPIC).repositoryUpdated(myRepository);
      BackgroundTaskUtil.syncPublisher(myProject, VcsManagedFilesHolder.TOPIC).updatingModeChanged();
      ChangeListManagerImpl.getInstanceImpl(myProject).notifyUnchangedFileStatusChanged();
      notifyExcludedSynchronizer(oldIgnored, newIgnored);
    }
    finally {
      BackgroundTaskUtil.syncPublisher(myProject, GitRefreshListener.TOPIC).progressStopped();
    }
  }
private void update()