public static @Nullable GitSubmodule getRepositoryIfSubmodule(@NotNull Project project, @NotNull FilePath path) {
    // NB: deletion of a submodule is not supported yet
    GitRepositoryManager repositoryManager = GitRepositoryManager.getInstance(project);
    GitRepository candidate = repositoryManager.getRepositoryForRootQuick(path);
    if (candidate == null) { // not a root
      return null;
    }
    return GitSubmoduleKt.asSubmodule(candidate);
  }
public static @Nullable GitSubmodule getRepositoryIfSubmodule(@NotNull Project project, @NotNull FilePath path)