private static @NotNull GitCommandResult run(@NotNull GitLineHandler handler, @NotNull OutputCollector outputCollector) {
    GitVersion version = GitVersion.NULL;
    if (handler.isPreValidateExecutable()) {
      GitExecutable executable = handler.getExecutable();
      try {
        version = GitExecutableManager.getInstance().identifyVersion(executable);

        if (version.getType() == GitVersion.Type.WSL1 &&
            !Registry.is("git.allow.wsl1.executables")) {
          throw new GitNotInstalledException(GitBundle.message("executable.error.git.not.installed"), null);
        }
      }
      catch (ProcessCanceledException e) {
        throw e;
      }
      catch (Exception e) {
        Project project = handler.project();
        if (project != null) {
          GitExecutableProblemsNotifier.getInstance(project).notifyExecutionError(e);
        }
        return GitCommandResult.startError(GitBundle.message("git.executable.validation.error.start.title") + ": \n" +
                                           GitExecutableProblemsNotifier.getPrettyErrorMessage(e));
      }
    }

    Project project = handler.project();
    if (project != null && project.isDisposed()) {
      LOG.warn("Project has already been disposed");
      throw new ProcessCanceledException();
    }

    if (project != null && handler.isEnableInteractiveCallbacks()) {
      try (GitHandlerAuthenticationManager authenticationManager = GitHandlerAuthenticationManager.prepare(project, handler, version)) {
        try (GitHandlerRebaseEditorManager ignored = prepareGeneralPurposeEditor(project, handler)) {
          GitCommandResult result = doRun(handler, version, outputCollector);
          return GitCommandResult.withAuthentication(result, authenticationManager.isHttpAuthFailed());
        }
      }
      catch (IOException e) {
        return GitCommandResult.startError(GitBundle.message("git.executable.unknown.error.message", e.getLocalizedMessage()));
      }
    }
    else {
      return doRun(handler, version, outputCollector);
    }
  }
private static @NotNull GitCommandResult run(@NotNull GitLineHandler handler, @NotNull OutputCollector outputCollector)