public static void main(String[] args) throws IOException, GitAPIException {
// prepare a new test-repository
Repository repository = CookbookHelper.openJGitCookbookRepository();
BlameCommand blamer = new BlameCommand(repository);
ObjectId commitID = repository.resolve("HEAD");
blamer.setStartCommit(commitID);
blamer.setFilePath("README.md");
BlameResult blame = blamer.call();
// read the number of lines from the commit to not look at changes in the working copy
int lines = countFiles(repository, commitID, "README.md");
for (int i = 0; i < lines; i++) {
RevCommit commit = blame.getSourceCommit(i);