public List<BlameLine> blame(Git git, String filename) {
    BlameResult blameResult;
    try {
      blameResult = git.blame()
        // Equivalent to -w command line option
        .setTextComparator(RawTextComparator.WS_IGNORE_ALL)
        .setFilePath(filename).call();
    } catch (Exception e) {
      throw new IllegalStateException("Unable to blame file " + filename, e);
    }
    List<BlameLine> lines = new ArrayList<>();
    if (blameResult == null) {
      LOG.debug("Unable to blame file {}. It is probably a symlink.", filename);
      return emptyList();
    }
    for (int i = 0; i < blameResult.getResultContents().size(); i++) {
      if (blameResult.getSourceAuthor(i) == null || blameResult.getSourceCommit(i) == null) {
        LOG.debug("Unable to blame file {}. No blame info at line {}. Is file committed? [Author: {} Source commit: {}]", filename, i + 1,
          blameResult.getSourceAuthor(i), blameResult.getSourceCommit(i));
        return emptyList();
      }
      lines.add(new BlameLine()
        .date(blameResult.getSourceCommitter(i).getWhen())
        .revision(blameResult.getSourceCommit(i).getName())
        .author(blameResult.getSourceAuthor(i).getEmailAddress()));
    }

    return lines;
  }
@Test
  public void blame_returns_all_lines() {


    try (Git git = loadRepository(baseDir)) {
      List<BlameLine> blameLines = jGitBlameCommand.blame(git, DUMMY_JAVA);

      Date revisionDate1 = DateUtils.parseDateTime("2012-07-17T16:12:48+0200");
      String revision1 = "6b3aab35a3ea32c1636fee56f996e677653c48ea";
      String author1 = "david@gageot.net";

      // second commit, which has a commit date different than the author date
      Date revisionDate2 = DateUtils.parseDateTime("2015-05-19T13:31:09+0200");
      String revision2 = "0d269c1acfb8e6d4d33f3c43041eb87e0df0f5e7";
      String author2 = "duarte.meneses@sonarsource.com";

      List<BlameLine> expectedBlame = new LinkedList<>();
      for (int i = 0; i < 25; i++) {
        expectedBlame.add(new BlameLine().revision(revision1).date(revisionDate1).author(author1));
      }
      for (int i = 0; i < 3; i++) {
        expectedBlame.add(new BlameLine().revision(revision2).date(revisionDate2).author(author2));
      }
      for (int i = 0; i < 1; i++) {
        expectedBlame.add(new BlameLine().revision(revision1).date(revisionDate1).author(author1));
      }

      assertThat(blameLines).isEqualTo(expectedBlame);
    }
  }