我想获取修订版 XXXXXX 和 HEAD 之间更改/添加/删除文件的列表。这是我到目前为止所拥有的:
String oldHash = "a97e5553e37a25bd1a3c99eab303145baed08dbd";
Git git = Git.open(new File("/tmp/jgit"));
Repository repository = git.getRepository();
ObjectId old = repository.resolve(oldHash);
ObjectId head = repository.resolve("HEAD");
// how do i get the trees from the obj. id?
List<<DiffEntry> diffs = git.diff().setNewTree(null).setOldTree(null).call();
for(DiffEntry diff : diffs) {
// do stuff
}
这是正确的方法吗?如果是,我如何获得 git.diff() 所需的树?