private @Nullable GitPushTargetType getPushTargetType(GitRepository repository, PushSpec<GitPushSource, GitPushTarget> spec) {
    GitPushSource pushSource = spec.getSource();
    GitPushTarget target = spec.getTarget();

    GitPushTargetType targetType = spec.getTarget().getTargetType();
    // Effective target branch can still be a tracking branch or a branch from spec
    // E.g., user changed branch to custom in a push dialog and then reverted it to default
    if (targetType == GitPushTargetType.CUSTOM) {
      GitLocalBranch sourceBranch = pushSource.getBranch();
      if (sourceBranch != null) {
        GitPushTarget defaultTarget = myPushSupport.getDefaultTarget(repository, pushSource);
        if (defaultTarget != null && defaultTarget.getBranch().equals(target.getBranch())) {
          targetType = defaultTarget.getTargetType();
        }
      }
    }

    return targetType;
  }
private @Nullable GitPushTargetType getPushTargetType(GitRepository repository, PushSpec<GitPushSource, GitPushTarget> spec)