简体   繁体   中英

How to archive diff files between two commit with jgit?

I'm trying to create an archive between two commits on my branch,but have no idea..

here's my code:

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

I use git command like this git archive --output=files.tar HEAD $(git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT 809365fe 7793cf5) how can I do this command with jGit?

thanks for every reply!

You cannot archive diffs, neither with Git nor with JGit. An archive is always created from a tree.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM