private void rollbackChanges(@NotNull Collection<? extends VirtualFile> rootsToSave,
                               @NotNull Collection<Change> shelvedChanges) {
    if (GitVersionSpecialty.RESTORE_SUPPORTED.existsIn(myProject)) {
      Set<FilePath> filePaths = new HashSet<>();
      for (Change change : shelvedChanges) {
        ContainerUtil.addAllNotNull(filePaths, ChangesUtil.getBeforePath(change));
        ContainerUtil.addAllNotNull(filePaths, ChangesUtil.getAfterPath(change));
      }

      GitUtil.sortFilePathsByGitRootIgnoringMissing(myProject, filePaths).forEach((root, paths) -> {
        if (!rootsToSave.contains(root)) {
          LOG.warn(String.format("Paths not under shelved root: root - %s, paths - %s, shelved roots - %s", root, paths, rootsToSave));
          return;
        }

        GitRepository repository = GitRepositoryManager.getInstance(myProject).getRepositoryForRoot(root);
        boolean isFreshRepository = repository != null && repository.getCurrentRevision() == null;
        if (isFreshRepository) {
          resetHardLocal(myProject, root);
        }
        else {
          restoreStagedWorktree(myProject, root, paths);
        }
      });
    }
    else {
      for (VirtualFile root : rootsToSave) {
        resetHardLocal(myProject, root);
      }
    }

    for (VirtualFile root : rootsToSave) {
      VcsDirtyScopeManager.getInstance(myProject).dirDirtyRecursively(root);
    }
  }
private void rollbackChanges(@NotNull Collection<? extends VirtualFile> rootsToSave,
                               @NotNull Collection<Change> shelvedChanges)