如何使用jgit遍历特定分支的特定提交的所有内容?
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");
}
此代码从提交中检索一个特殊文件,但我想遍历提交的所有内容。