VirtualFile (@NotNull Project project, @Nullable VirtualFile file) { VirtualFile root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file); if (root != null) return root; if (file != null) { root = getVcsRootForLibraryFile(project, file); if (root != null) return root; } return null; }