From 76c13d02f5a5d80aa51f51440610bced4adf2c28 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 28 Apr 2021 14:45:03 +0400 Subject: [PATCH] #27 -- fix read commits --- .../ulstu/extractor/service/GitRepositoryService.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java index 4abd879..924180d 100644 --- a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java +++ b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java @@ -107,17 +107,13 @@ public class GitRepositoryService { Git git = new Git(localRepo); List commits = new ArrayList<>(); - git.log().call().forEach(commits::add); + git.log().setSkip(commitsFrom).setMaxCount(commitsTo - commitsFrom).call().forEach(commits::add); List list = new ArrayList<>(); RevCommit prevCommit = null; LOG.debug("Start analyse {} commits", commits.size()); - commitsFrom = Math.max(commitsFrom, 0); - commitsTo = Math.min(commitsTo, commits.size()); - commitsTo = Math.max(commitsTo, 0); - for (int i = commitsFrom; i < commitsTo; i++) { - RevCommit revCommit = commits.get(i); - LOG.debug(" {} to {} commits", i, commitsTo); + LOG.debug(" {} to {} commits", commitsFrom, commitsTo); + for (RevCommit revCommit : commits) { Commit commit = new Commit( revCommit.getFullMessage(), new Author(revCommit.getAuthorIdent().getName()),