void (@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection<? extends ChangedPath> changes, @NotNull Set<FilePath> unstagedDeletions) { List<VcsException> restoreExceptions = new ArrayList<>(); Set<FilePath> toAdd = new HashSet<>(); Set<FilePath> toRemove = new HashSet<>(); for (ChangedPath change : changes) { if (addAsCaseOnlyRename(project, root, change, restoreExceptions)) continue; if (change.beforePath == null && unstagedDeletions.contains(change.afterPath)) { // we can't restore ADDED-DELETED files LOG.info("Ignored added-deleted staged change in " + change.afterPath); continue; } addIfNotNull(toAdd, change.afterPath); addIfNotNull(toRemove, change.beforePath); } toRemove.removeAll(toAdd); LOG.debug(String.format("Restoring staged changes after commit: added: %s, removed: %s", toAdd, toRemove)); updateIndex(project, root, toAdd, toRemove, restoreExceptions); for (VcsException e : restoreExceptions) { LOG.warn(e); } }