@@ -614,6 +614,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
614
614
log .addPath (getRepoRelativePath (file ));
615
615
}
616
616
617
+ // TODO: convert log to RevWalk (with FollowFilter for renamed file handling)
617
618
Iterable <RevCommit > commits = log .call ();
618
619
for (RevCommit commit : commits ) {
619
620
int numParents = commit .getParentCount ();
@@ -629,7 +630,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
629
630
630
631
SortedSet <String > files = new TreeSet <>();
631
632
if (numParents == 1 ) {
632
- getFiles (repository , git , commit .getParent (0 ), commit , files , renamedFiles );
633
+ getFiles (repository , commit .getParent (0 ), commit , files , renamedFiles );
633
634
} else if (numParents == 0 ) { // first commit (TODO: could be dangling ?)
634
635
try (TreeWalk treeWalk = new TreeWalk (repository )) {
635
636
treeWalk .addTree (commit .getTree ());
@@ -640,7 +641,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
640
641
}
641
642
}
642
643
} else {
643
- getFiles (repository , git , commit .getParent (0 ), commit , files , renamedFiles );
644
+ getFiles (repository , commit .getParent (0 ), commit , files , renamedFiles );
644
645
}
645
646
646
647
historyEntry .setFiles (files );
@@ -671,14 +672,14 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
671
672
return result ;
672
673
}
673
674
674
- private void getFiles (org .eclipse .jgit .lib .Repository repository , Git git ,
675
+ private void getFiles (org .eclipse .jgit .lib .Repository repository ,
675
676
RevCommit oldCommit , RevCommit newCommit ,
676
677
Set <String > files , List <String > renamedFiles )
677
678
throws IOException {
678
679
679
680
OutputStream outputStream = NullOutputStream .INSTANCE ;
680
681
try (DiffFormatter formatter = new DiffFormatter (outputStream )) {
681
- formatter .setRepository (git . getRepository () );
682
+ formatter .setRepository (repository );
682
683
formatter .setDetectRenames (true );
683
684
684
685
List <DiffEntry > diffs = formatter .scan (prepareTreeParser (repository , oldCommit ),
0 commit comments