From 68be05da2fe91835e1f246d96e91b03ff1ea194d Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 28 Mar 2024 13:29:46 +0100 Subject: [PATCH] EA-1148851 EA-1148850 vcs: do not try to create FilePath from non-local virtual files GitOrigin-RevId: 87d72a43a3309531b669bb0a3ff09f4a7e218efa --- .../openapi/vcs/changes/ChangeListManagerImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index 11434c44d4d8..71f6cf21c2a2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -939,6 +939,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override public boolean isFileAffected(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return false; synchronized (myDataLock) { return myWorker.getStatus(file) != null; } @@ -1129,6 +1130,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override @Nullable public Change getChange(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return null; return getChange(VcsUtil.getFilePath(file)); } @@ -1149,6 +1151,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @NotNull @Override public List getChangeLists(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return Collections.emptyList(); synchronized (myDataLock) { Change change = myWorker.getChangeForPath(VcsUtil.getFilePath(file)); if (change == null) return Collections.emptyList(); @@ -1178,6 +1181,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override public boolean isUnversioned(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return false; VcsRoot vcsRoot; try (AccessToken ignore = SlowOperations.knownIssue("IDEA-322445, EA-857508")) { vcsRoot = ProjectLevelVcsManager.getInstance(myProject).getVcsRootObjectFor(file); @@ -1200,6 +1204,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override @NotNull public FileStatus getStatus(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return FileStatus.NOT_CHANGED; return getStatus(VcsUtil.getFilePath(file), file); } @@ -1230,6 +1235,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override @NotNull public Collection getChangesIn(@NotNull VirtualFile dir) { + if (!dir.isInLocalFileSystem()) return Collections.emptySet(); return getChangesIn(VcsUtil.getFilePath(dir)); } @@ -1381,6 +1387,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override public boolean isIgnoredFile(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return false; return isIgnoredFile(VcsUtil.getFilePath(file)); } @@ -1445,6 +1452,7 @@ public final class ChangeListManagerImpl extends ChangeListManagerEx implements @Override @Nullable public String getSwitchedBranch(@NotNull VirtualFile file) { + if (!file.isInLocalFileSystem()) return null; return ReadAction.compute(() -> { synchronized (myDataLock) { return myComposite.getSwitchedFileHolder().getBranchForFile(file);