@Nls
  private static String getDetachedStatePresentableText(@NotNull GitRepository repository,
                                                        @NotNull Function<@NotNull @NlsSafe String,
                                                        @NotNull @NlsSafe String> branchNameTruncator) {
    GitReference currentReference = GitRefUtil.getCurrentReference(repository);
    if (currentReference instanceof GitTag) {
      return branchNameTruncator.apply(currentReference.getName());
    }
    else {
      String currentRevision = repository.getCurrentRevision();
      if (currentRevision != null) {
        return DvcsUtil.getShortHash(currentRevision);
      }
      else {
        LOG.warn(String.format("Current revision is null in DETACHED state. isFresh: %s", repository.isFresh()));
        return GitBundle.message("git.status.bar.widget.text.unknown");
      }
    }
  }
@Nls
  private static String getDetachedStatePresentableText(@NotNull GitRepository repository,
                                                        @NotNull Function<@NotNull @NlsSafe String,
                                                        @NotNull @NlsSafe String> branchNameTruncator)