From 0ec7ee057a186ed5ab8868ddd40e62aaf3d2196f Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 18 Jul 2018 17:57:41 +0300 Subject: [PATCH] IDEA-106293 vcs: unconditionally drop FileStatus cache after Local Changes update If typing in an unchanged file is quickly reverted, file could stuck in "modified" state. ex: on "Ctrl+V Ctrl+S Ctrl+Z" action sequence * File modified -- DocumentListener in FileStatusManager marks its status as "modified" * File saved on disk -- CLM refresh is scheduled * Changes in document are reverted -- LineStatusTracker notices, that all changes are reverted and saves the file on disk again. -- Another CLM refresh is scheduled * CLM refresh finished, but no changes are detected (as the file is no longer modified on disk) -- FileStatus refresh in ChangeListWorker is skipped --- .../openapi/vcs/changes/ChangeListWorker.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java index f0b839f7d86b..56c0bfac989b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java @@ -618,7 +618,7 @@ public class ChangeListWorker { @NotNull PlusMinusModify deltaListener) { HashMap oldChangeMappings = new HashMap<>(myChangeMappings); - boolean somethingChanged = notifyPathsChanged(myIdx, updatedWorker.myIdx, deltaListener); + notifyPathsChanged(myIdx, updatedWorker.myIdx, deltaListener); myIdx.copyFrom(updatedWorker.myIdx); myChangeMappings.clear(); @@ -654,9 +654,7 @@ public class ChangeListWorker { } } - if (somethingChanged) { - FileStatusManager.getInstance(myProject).fileStatusesChanged(); - } + FileStatusManager.getInstance(myProject).fileStatusesChanged(); if (myMainWorker) { myDelayedNotificator.allChangeListsMappingsChanged(); @@ -667,8 +665,8 @@ public class ChangeListWorker { } } - private static boolean notifyPathsChanged(@NotNull ChangeListsIndexes was, @NotNull ChangeListsIndexes became, - @NotNull PlusMinusModify deltaListener) { + private static void notifyPathsChanged(@NotNull ChangeListsIndexes was, @NotNull ChangeListsIndexes became, + @NotNull PlusMinusModify deltaListener) { final Set toRemove = new HashSet<>(); final Set toAdd = new HashSet<>(); final Set> toModify = new HashSet<>(); @@ -683,7 +681,6 @@ public class ChangeListWorker { for (BeforeAfter beforeAfter : toModify) { deltaListener.modify(beforeAfter.getBefore(), beforeAfter.getAfter()); } - return !toRemove.isEmpty() || !toAdd.isEmpty(); } void setChangeLists(@NotNull Collection lists) {