From bb22c507267c5f6593bbbbf74d8e8afc8ad10919 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Oct 2017 17:42:04 +0300 Subject: [PATCH] Simply VFS events processing in GitUntrackedFilesHolder No need to process VFileCopyEvent differently. VFileCopyEvent.getFile() returns file in its current location. If the file was already moved since the event was posted, copyEvent.getNewParent().findChild() would either return null, or return some other unrelated file. If the file was not moved, the calls are equivalent. --- .../git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java b/plugins/git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java index ab32ef61a683..3f98d2435806 100644 --- a/plugins/git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java +++ b/plugins/git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java @@ -300,13 +300,9 @@ public class GitUntrackedFilesHolder implements Disposable, AsyncVfsEventsListen if (event instanceof VFileCreateEvent) { return ((VFileCreateEvent)event).getParent().isValid() ? event.getFile() : null; } - else if (event instanceof VFileDeleteEvent || event instanceof VFileMoveEvent || isRename(event)) { + if (event instanceof VFileCopyEvent || event instanceof VFileDeleteEvent || event instanceof VFileMoveEvent || isRename(event)) { return event.getFile(); } - else if (event instanceof VFileCopyEvent) { - VFileCopyEvent copyEvent = (VFileCopyEvent) event; - return copyEvent.getNewParent().findChild(copyEvent.getNewChildName()); - } return null; }); }