private static @NlsContexts.NotificationContent String formRepoDescription(@NotNull GitPushRepoResult result) {
    @NotNull HtmlChunk sourceBranch = HtmlChunk.text(GitBranchUtil.stripRefsPrefix(result.getSourceBranch()));
    @NotNull HtmlChunk targetBranch = HtmlChunk.text(GitBranchUtil.stripRefsPrefix(result.getTargetBranch()));
    @NotNull HtmlChunk remoteName = HtmlChunk.text(result.getTargetRemote());
    @NotNull List<String> pushedTags = result.getPushedTags();

    final HtmlChunk tagName = !pushedTags.isEmpty() ? HtmlChunk.text(tagName(pushedTags)) : HtmlChunk.empty();
    return switch (result.getType()) {
      case SUCCESS -> {
        int commitNum = result.getNumberOfPushedCommits();
        yield selectBundleMessageWithTags(
          pushedTags,
          () -> GitBundle.message("push.notification.description.pushed", commitNum, targetBranch),
          () -> GitBundle.message("push.notification.description.pushed.with.single.tag", commitNum, targetBranch, tagName,
                                  remoteName),
          () -> GitBundle.message("push.notification.description.pushed.with.many.tags", commitNum, targetBranch, pushedTags.size(),
                                  remoteName)
        );
      }
      case NEW_BRANCH -> selectBundleMessageWithTags(
        pushedTags,
        () -> GitBundle.message("push.notification.description.new.branch", sourceBranch, targetBranch),
        () -> GitBundle.message("push.notification.description.new.branch.with.single.tag", sourceBranch, targetBranch, tagName,
                                remoteName),
        () -> GitBundle.message("push.notification.description.new.branch.with.many.tags", sourceBranch, targetBranch, pushedTags.size(),
                                remoteName)
      );
      case UP_TO_DATE -> selectBundleMessageWithTags(
        pushedTags,
        () -> GitBundle.message("push.notification.description.up.to.date"),
        () -> GitBundle.message("push.notification.description.pushed.single.tag", tagName, remoteName),
        () -> GitBundle.message("push.notification.description.pushed.many.tags", pushedTags.size(), remoteName)
      );
      case FORCED -> GitBundle.message("push.notification.description.force.pushed", sourceBranch, targetBranch);
      case REJECTED_NO_FF -> {
        GitUpdateResult updateResult = result.getUpdateResult();
        yield updateResult == null ? GitBundle.message("push.notification.description.rejected", targetBranch) : switch (updateResult) {
          case SUCCESS, NOTHING_TO_UPDATE -> GitBundle.message("push.notification.description.rejected", targetBranch);
          case SUCCESS_WITH_RESOLVED_CONFLICTS -> GitBundle.message("push.notification.description.rejected.and.conflicts");
          case INCOMPLETE -> GitBundle.message("push.notification.description.rejected.and.incomplete");
          case CANCEL -> GitBundle.message("push.notification.description.rejected.and.cancelled");
          default -> GitBundle.message("push.notification.description.rejected.and.failed");
        };
      }
      case REJECTED_STALE_INFO -> GitBundle.message("push.notification.description.push.with.lease.rejected", sourceBranch, targetBranch);
      case REJECTED_OTHER -> GitBundle.message("push.notification.description.rejected.by.remote", sourceBranch, targetBranch);
      case ERROR -> XmlStringUtil.escapeString(result.getError());
      default -> {
        LOG.error("Unexpected push result: " + result);
        yield "";
      }
    };
  }
private static @NlsContexts.NotificationContent String formRepoDescription(@NotNull GitPushRepoResult result)