How can I traverse with jgit all content of an specific commit from an specific branch?
ObjectId commitId = repository.resolve(currentCommit.getCommitHash());
RevWalk revWalk = new RevWalk(repository);
RevCommit commit = revWalk.parseCommit(commitId);
RevTree tree = commit.getTree();
TreeWalk treeWalk = new TreeWalk(repository);
treeWalk.addTree(tree);
treeWalk.setRecursive(true);
treeWalk.setFilter(PathFilter.create(currentPath));
if (!treeWalk.next()) {
throw new IllegalStateException(
"Did not find expected file README.md");
}
This code retrieve me a special file from the commit but I want traverse all content of an commit.