public static @NotNull VirtualFile getCorrectedVcsRoot(@NotNull GitRepositoryManager repositoryManager,
                                                         @NotNull VirtualFile detectedRoot,
                                                         @NotNull FilePath path) {
    if (path.isDirectory()) return detectedRoot;
    GitRepository repository = repositoryManager.getRepositoryForRootQuick(path);
    if (repository != null && repository.getRoot().equals(detectedRoot)) {
      GitSubmodule submodule = GitSubmoduleKt.asSubmodule(repository);
      if (submodule != null) {
        return submodule.getParent().getRoot();
      }
    }
    return detectedRoot;
  }
public static @NotNull VirtualFile getCorrectedVcsRoot(@NotNull GitRepositoryManager repositoryManager,
                                                         @NotNull VirtualFile detectedRoot,
                                                         @NotNull FilePath path)