public static @NotNull Hash loadStagedSubmoduleHash(@NotNull GitRepository submodule,
                                                      @NotNull GitRepository parentRepo) throws VcsException {
    GitLineHandler h = new GitLineHandler(parentRepo.getProject(), parentRepo.getRoot(), GitCommand.SUBMODULE);
    h.addParameters("status", "--cached");
    h.addRelativeFiles(Collections.singletonList(submodule.getRoot()));
    String out = Git.getInstance().runCommand(h).getOutputOrThrow();

    StringScanner s = new StringScanner(out);
    s.skipChars(1); // status char
    String hash = s.spaceToken();
    return HashImpl.build(hash);
  }
public static @NotNull Hash loadStagedSubmoduleHash(@NotNull GitRepository submodule,
                                                      @NotNull GitRepository parentRepo)