#27 -- fix read commits

This commit is contained in:
Anton Romanov 2021-04-28 14:45:03 +04:00
parent fd15fd52df
commit 76c13d02f5

View File

@ -107,17 +107,13 @@ public class GitRepositoryService {
Git git = new Git(localRepo); Git git = new Git(localRepo);
List<RevCommit> commits = new ArrayList<>(); List<RevCommit> commits = new ArrayList<>();
git.log().call().forEach(commits::add); git.log().setSkip(commitsFrom).setMaxCount(commitsTo - commitsFrom).call().forEach(commits::add);
List<Commit> list = new ArrayList<>(); List<Commit> list = new ArrayList<>();
RevCommit prevCommit = null; RevCommit prevCommit = null;
LOG.debug("Start analyse {} commits", commits.size()); LOG.debug("Start analyse {} commits", commits.size());
commitsFrom = Math.max(commitsFrom, 0); LOG.debug(" {} to {} commits", commitsFrom, commitsTo);
commitsTo = Math.min(commitsTo, commits.size()); for (RevCommit revCommit : commits) {
commitsTo = Math.max(commitsTo, 0);
for (int i = commitsFrom; i < commitsTo; i++) {
RevCommit revCommit = commits.get(i);
LOG.debug(" {} to {} commits", i, commitsTo);
Commit commit = new Commit( Commit commit = new Commit(
revCommit.getFullMessage(), revCommit.getFullMessage(),
new Author(revCommit.getAuthorIdent().getName()), new Author(revCommit.getAuthorIdent().getName()),