GitCommandResult (final @NotNull GitRepository repository, final @NotNull String remoteName, final @NotNull Collection<String> remoteUrls, final @NotNull String spec, final boolean force, final boolean updateTracking, final boolean skipHook, final List<? extends GitPushParams.ForceWithLease> forceWithLease, final @Nullable String tagMode, final GitLineHandlerListener @NotNull ... listeners) { return runCommand(() -> { final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.PUSH); h.setUrls(remoteUrls); h.setSilent(false); h.setStdoutSuppressed(false); addListeners(h, listeners); if(GitVersionSpecialty.ABLE_TO_USE_PROGRESS_IN_REMOTE_COMMANDS.existsIn(repository)) { h.addParameters("--progress"); } h.addParameters("--porcelain"); h.addParameters(remoteName); h.addParameters(spec); if (updateTracking) { h.addParameters("--set-upstream"); } if (GitVersionSpecialty.SUPPORTS_FORCE_PUSH_WITH_LEASE.existsIn(repository) && !forceWithLease.isEmpty()) { for (GitPushParams.ForceWithLease lease : forceWithLease) { String parameter = lease.getParameter(); if (parameter != null) { h.addParameters("--force-with-lease=" + parameter); } else { h.addParameters("--force-with-lease"); } } } else if (force) { h.addParameters("--force"); } if (tagMode != null) { h.addParameters(tagMode); } if (skipHook) { h.addParameters("--no-verify"); } return h; }); }