Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get all the commits
- Iterable<RevCommit> commits = gitRepo.log().all().call();
- // Iterate over the single commit
- for (RevCommit commit : commits) {
- // a RevWalk allows to walk over commits based on some filtering that is defined
- try (RevWalk revWalk = new RevWalk(repository)) {
- // and using commit's tree find the path
- if (commit.getParentCount() > 0) {
- RevCommit headCommit = commit.getParent(0);
- FileOutputStream stdout = new FileOutputStream(FileDescriptor.out);
- try (DiffFormatter diffFormatter = new DiffFormatter(stdout)) {
- diffFormatter.setRepository(repository);
- for (DiffEntry entry : diffFormatter.scan(headCommit, commit)) {
- System.out.println(entry.getNewPath());
- }
- }
- }
- revWalk.dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement