private @NotNull Repository.State readRepositoryState(@NotNull HeadInfo headInfo) {
    if (isMergeInProgress()) {
      return Repository.State.MERGING;
    }
    if (isRebaseInProgress()) {
      return Repository.State.REBASING;
    }
    if (!headInfo.isBranch) {
      return Repository.State.DETACHED;
    }
    if (isCherryPickInProgress()) {
      return Repository.State.GRAFTING;
    }
    if (isRevertInProgress()) {
      return Repository.State.REVERTING;
    }
    return Repository.State.NORMAL;
  }
private @NotNull Repository.State readRepositoryState(@NotNull HeadInfo headInfo)