Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1249,10 +1249,10 @@ public DiffStats getDiffStats(Plugin plugin, boolean dryRun) {
.readEnvironment()
.findGitDir()
.build();
Git git = new Git(repository)) {
Git git = new Git(repository);
ObjectReader reader = repository.newObjectReader();
DiffFormatter formatter = new DiffFormatter(new ByteArrayOutputStream())) {

ObjectReader reader = repository.newObjectReader();
DiffFormatter formatter = new DiffFormatter(new ByteArrayOutputStream());
formatter.setRepository(repository);
formatter.setDiffComparator(RawTextComparator.DEFAULT);
formatter.setDetectRenames(true);
Expand Down Expand Up @@ -1296,8 +1296,10 @@ public DiffStats getDiffStats(Plugin plugin, boolean dryRun) {

CanonicalTreeParser oldTree = new CanonicalTreeParser();
CanonicalTreeParser newTree = new CanonicalTreeParser();
oldTree.reset(reader, new RevWalk(repository).parseTree(defaultBranch));
newTree.reset(reader, new RevWalk(repository).parseTree(head));
try (RevWalk revWalk = new RevWalk(repository)) {
oldTree.reset(reader, revWalk.parseTree(defaultBranch));
newTree.reset(reader, revWalk.parseTree(head));
}

List<DiffEntry> committedDiffs = git.diff()
.setOldTree(oldTree)
Expand All @@ -1313,7 +1315,6 @@ public DiffStats getDiffStats(Plugin plugin, boolean dryRun) {
}
changedFiles++;
}
reader.close();
return new DiffStats(additions, deletions, changedFiles);

} catch (IOException | GitAPIException e) {
Expand Down
Loading