From 783963b227a2450770c67c05ea344d51816038cf Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 22 Mar 2016 18:11:33 +0300 Subject: [PATCH] vcs: IDEA-153272 Don't discriminate unversioned and ignored files When a file is moved and overwrites existing file (with the same name), at first it is deleted in the new place. This deletion would schedule a `git rm` operation, however there is a logic which prevents from these files to be deleted in the case of overwrite. However this logic was not enabled for unversioned and ignored files. filterOutUnknownFiles() is not needed anymore since unknown files are not filtered in all cases. --- .../intellij/openapi/vcs/VcsVFSListener.java | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java index daae2529369f..4469d617bc92 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java @@ -21,7 +21,6 @@ import com.intellij.openapi.command.CommandAdapter; import com.intellij.openapi.command.CommandEvent; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; @@ -267,10 +266,6 @@ public abstract class VcsVFSListener implements Disposable { } } - protected boolean filterOutUnknownFiles() { - return true; - } - protected void processMovedFile(VirtualFile file, String newParentPath, String newName) { final FileStatus status = FileStatusManager.getInstance(myProject).getStatus(file); LOG.debug("Checking moved file " + file + "; status=" + status); @@ -280,21 +275,19 @@ public abstract class VcsVFSListener implements Disposable { myDirtyFiles.add(file); // will be at new path } } - if (!(filterOutUnknownFiles() && status == FileStatus.UNKNOWN) && status != FileStatus.IGNORED) { - final String newPath = newParentPath + "/" + newName; - boolean foundExistingInfo = false; - for (MovedFileInfo info : myMovedFiles) { - if (Comparing.equal(info.myFile, file)) { - info.myNewPath = newPath; - foundExistingInfo = true; - break; - } - } - if (!foundExistingInfo) { - LOG.debug("Registered moved file " + file); - myMovedFiles.add(new MovedFileInfo(file, newPath)); + final String newPath = newParentPath + "/" + newName; + boolean foundExistingInfo = false; + for (MovedFileInfo info : myMovedFiles) { + if (Comparing.equal(info.myFile, file)) { + info.myNewPath = newPath; + foundExistingInfo = true; + break; } } + if (!foundExistingInfo) { + LOG.debug("Registered moved file " + file); + myMovedFiles.add(new MovedFileInfo(file, newPath)); + } } private void executeMoveRename() {