如何使用 jgit 归档两次提交之间的差异文件?

How to archive diff files between two commit with jgit?

我正在尝试在我的分支上的两个提交之间创建一个存档,但不知道..

这是我的代码:

ArchiveCommand.registerFormat("zip", new ZipArchiveFormat());                 
git.archive()
.setTree(repo.resolve("refs/heads/master^{tree}"))
.setFormat("zip")
.setOutputStream(new FileOutputStream(new File("test.zip")))
.call();

我像这样使用 git 命令 git archive --output=files.tar HEAD $(git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT 809365fe 7793cf5) 我如何使用 jGit 执行此命令?

感谢每一个回复!

您无法归档差异,无论是 Git 还是 JGit。存档总是从树创建的。