void (final @NotNull List<MovedFileInfo> movedFiles) { List<FilePath> toAdd = new ArrayList<>(); List<FilePath> toRemove = new ArrayList<>(); List<MovedFileInfo> toForceMove = new ArrayList<>(); for (MovedFileInfo movedInfo : movedFiles) { String oldPath = movedInfo.myOldPath; String newPath = movedInfo.myNewPath; if (!movedInfo.isCaseSensitive() && GitUtil.isCaseOnlyChange(oldPath, newPath)) { toForceMove.add(movedInfo); } else { toRemove.add(movedInfo.getOldPath()); toAdd.add(movedInfo.getNewPath()); } } Collection<FilePath> selectedToAdd; Collection<FilePath> selectedToRemove; if (isStageEnabled()) { selectedToAdd = selectFilePathsToAdd(toAdd); selectedToRemove = selectFilePathsToDelete(toRemove); } else if (Value.DO_NOTHING_SILENTLY.equals(myRemoveOption.getValue()) && Value.DO_NOTHING_SILENTLY.equals(myAddOption.getValue())) { selectedToAdd = Collections.emptyList(); selectedToRemove = Collections.emptyList(); } else { selectedToAdd = toAdd; selectedToRemove = toRemove; } if (toAdd.isEmpty() && toRemove.isEmpty() && toForceMove.isEmpty()) return; LOG.debug("performMoveRename. \ntoAdd: " + toAdd + "\ntoRemove: " + toRemove + "\ntoForceMove: " + toForceMove); GitVcs.runInBackground(new Task.Backgroundable(myProject, message("progress.title.moving.files")) { @Override public void run(@NotNull ProgressIndicator indicator) { try { List<FilePath> dirtyPaths = new ArrayList<>(); List<File> toRefresh = new ArrayList<>(); //perform adding for (Map.Entry<VirtualFile, List<FilePath>> toAddEntry : GitUtil.sortFilePathsByGitRootIgnoringMissing(myProject, selectedToAdd).entrySet()) { List<FilePath> files = toAddEntry.getValue(); executeAdding(toAddEntry.getKey(), files); dirtyPaths.addAll(files); } //perform deletion for (Map.Entry<VirtualFile, List<FilePath>> toRemoveEntry : GitUtil.sortFilePathsByGitRootIgnoringMissing(myProject, selectedToRemove).entrySet()) { List<FilePath> paths = toRemoveEntry.getValue(); executeDeletion(toRemoveEntry.getKey(), paths); dirtyPaths.addAll(paths); } //perform force move if needed Map<FilePath, MovedFileInfo> filesToForceMove = map2Map(toForceMove, info -> Pair.create(info.getNewPath(), info)); dirtyPaths.addAll(map(toForceMove, fileInfo -> fileInfo.getOldPath())); for (Map.Entry<VirtualFile, List<FilePath>> toForceMoveEntry : GitUtil.sortFilePathsByGitRootIgnoringMissing(myProject, filesToForceMove.keySet()).entrySet()) { List<FilePath> paths = toForceMoveEntry.getValue(); toRefresh.addAll(executeForceMove(toForceMoveEntry.getKey(), paths, filesToForceMove)); dirtyPaths.addAll(paths); } VcsFileUtil.markFilesDirty(myProject, dirtyPaths); RefreshVFsSynchronously.refreshFiles(toRefresh); } catch (VcsException ex) { GitVcsConsoleWriter.getInstance(myProject).showMessage(ex.getMessage()); } } }); }