public static @NotNull List<String> fetchRepositoryCommits(@NotNull Project project, @NotNull String latestCommit) {
    String projectBasePath = project.getBasePath();
    if (projectBasePath == null) return Collections.emptyList();

    GeneralCommandLine commandLine = new GeneralCommandLine()
      .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)
      .withWorkDirectory(projectBasePath)
      .withExePath("git")
      .withParameters("log")
      .withParameters("--format=\"%H\"");
    if (!latestCommit.isEmpty()) {
      commandLine.addParameter(latestCommit);
    }
    commandLine.withParameters("-n")
      .withParameters(Integer.toString(FETCH_SIZE));

    StringBuilder processOutput = new StringBuilder();
    try {
      OSProcessHandler handler = new OSProcessHandler(commandLine.withCharset(StandardCharsets.UTF_8));
      handler.addProcessListener(new CapturingProcessAdapter() {
        @Override
        public void processTerminated(@NotNull ProcessEvent event) {
          if (event.getExitCode() != 0) {
            LOG.warn("Couldn't fetch N commits from the current repository: " + getOutput().getStderr());
          } else {
            processOutput.append(getOutput().getStdout());
          }
        }
      });
      handler.startNotify();
      handler.waitFor();
    }
    catch (ExecutionException e) {
      LOG.warn("Can't execute command for getting commit hashes", e);
    }
    String result = processOutput.toString();
    if (result.isEmpty()) return Collections.emptyList();
    return ContainerUtil.map(processOutput.toString().split("\n"), commit -> commit.substring(1, commit.length() - 1));
  }
public static @NotNull List<String> fetchRepositoryCommits(@NotNull Project project, @NotNull String latestCommit)