Skip to content

Commit 907de99

Browse files
author
Vladimir Kotal
committed
the git parameter is not needed
1 parent 86f2471 commit 907de99

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/GitRepository.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
614614
log.addPath(getRepoRelativePath(file));
615615
}
616616

617+
// TODO: convert log to RevWalk (with FollowFilter for renamed file handling)
617618
Iterable<RevCommit> commits = log.call();
618619
for (RevCommit commit : commits) {
619620
int numParents = commit.getParentCount();
@@ -629,7 +630,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
629630

630631
SortedSet<String> files = new TreeSet<>();
631632
if (numParents == 1) {
632-
getFiles(repository, git, commit.getParent(0), commit, files, renamedFiles);
633+
getFiles(repository, commit.getParent(0), commit, files, renamedFiles);
633634
} else if (numParents == 0) { // first commit (TODO: could be dangling ?)
634635
try (TreeWalk treeWalk = new TreeWalk(repository)) {
635636
treeWalk.addTree(commit.getTree());
@@ -640,7 +641,7 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
640641
}
641642
}
642643
} else {
643-
getFiles(repository, git, commit.getParent(0), commit, files, renamedFiles);
644+
getFiles(repository, commit.getParent(0), commit, files, renamedFiles);
644645
}
645646

646647
historyEntry.setFiles(files);
@@ -671,14 +672,14 @@ History getHistory(File file, String sinceRevision) throws HistoryException {
671672
return result;
672673
}
673674

674-
private void getFiles(org.eclipse.jgit.lib.Repository repository, Git git,
675+
private void getFiles(org.eclipse.jgit.lib.Repository repository,
675676
RevCommit oldCommit, RevCommit newCommit,
676677
Set<String> files, List<String> renamedFiles)
677678
throws IOException {
678679

679680
OutputStream outputStream = NullOutputStream.INSTANCE;
680681
try (DiffFormatter formatter = new DiffFormatter(outputStream)) {
681-
formatter.setRepository(git.getRepository());
682+
formatter.setRepository(repository);
682683
formatter.setDetectRenames(true);
683684

684685
List<DiffEntry> diffs = formatter.scan(prepareTreeParser(repository, oldCommit),

0 commit comments

Comments
 (0)