public static @NlsSafe @NotNull String getBranchNameOrRev(@NotNull GitRepository repository) {
    var repoInfo = repository.getInfo();
    if (repoInfo.isOnBranch()) {
      GitBranch currentBranch = repoInfo.getCurrentBranch();
      assert currentBranch != null;
      return currentBranch.getName();
    }
    else {
      String currentRevision = repoInfo.getCurrentRevision();
      return currentRevision != null ? currentRevision.substring(0, 7) : "";
    }
  }
public static @NlsSafe @NotNull String getBranchNameOrRev(@NotNull GitRepository repository)