public List<BlameLine> blame(Path baseDir, String fileName) throws Exception {
    BlameOutputProcessor outputProcessor = new BlameOutputProcessor();
    try {
      this.processWrapperFactory.create(
          baseDir,
          outputProcessor::process,
          gitCommand,
          GIT_DIR_FLAG, String.format(GIT_DIR_ARGUMENT, baseDir), GIT_DIR_FORCE_FLAG, baseDir.toString(),
          BLAME_COMMAND,
          BLAME_LINE_PORCELAIN_FLAG, IGNORE_WHITESPACES, FILENAME_SEPARATOR_FLAG, fileName)
        .execute();
    } catch (UncommittedLineException e) {
      LOG.debug("Unable to blame file '{}' - it has uncommitted changes", fileName);
      return emptyList();
    }
    return outputProcessor.getBlameLines();
  }
@Test
  public void git_blame_uses_safe_local_repository() throws Exception {
    File projectDir = createNewTempFolder();
    File baseDir = new File(projectDir, "dummy-git");

    ProcessWrapperFactory mockFactory = mock(ProcessWrapperFactory.class);
    ProcessWrapper mockProcess = mock(ProcessWrapper.class);
    String gitCommand = "git";
    when(mockFactory.create(any(), any(), anyString(), anyString(), anyString(), anyString(),
      anyString(), anyString(), anyString(), anyString(), anyString(), anyString()))
      .then(invocation -> mockProcess);

    NativeGitBlameCommand blameCommand = new NativeGitBlameCommand(gitCommand, System2.INSTANCE, mockFactory);
    blameCommand.blame(baseDir.toPath(), DUMMY_JAVA);

    verify(mockFactory).create(any(), any(), eq(gitCommand),
      eq(GIT_DIR_FLAG),
      eq(String.format(GIT_DIR_ARGUMENT, baseDir.toPath())),
      eq(GIT_DIR_FORCE_FLAG),
      eq(baseDir.toPath().toString()),
      eq(BLAME_COMMAND),
      anyString(), anyString(), anyString(), eq(DUMMY_JAVA));
  }