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.
This commit is contained in:
Kirill Likhodedov
2016-03-22 18:20:17 +03:00
parent e6a9a1c3f2
commit 783963b227
@@ -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() {