Fix commit log.

This commit is contained in:
takezoe
2013-06-19 03:22:49 +09:00
parent 3de5199575
commit 1679fb98d0

View File

@@ -212,8 +212,10 @@ object JGitUtil {
@scala.annotation.tailrec @scala.annotation.tailrec
def getCommitLog(i: java.util.Iterator[RevCommit], count: Int, logs: List[CommitInfo]): (List[CommitInfo], Boolean) = def getCommitLog(i: java.util.Iterator[RevCommit], count: Int, logs: List[CommitInfo]): (List[CommitInfo], Boolean) =
i.hasNext match { i.hasNext match {
case true if(limit <= 0 || logs.size < limit) => case true if(limit <= 0 || logs.size < limit) => {
getCommitLog(i, count + 1, if(limit <= 0 || (fixedPage - 1) * limit < count) logs :+ new CommitInfo(i.next) else logs) val commit = i.next
getCommitLog(i, count + 1, if(limit <= 0 || (fixedPage - 1) * limit <= count) logs :+ new CommitInfo(commit) else logs)
}
case _ => (logs, i.hasNext) case _ => (logs, i.hasNext)
} }
@@ -312,7 +314,8 @@ object JGitUtil {
} }
treeWalk.release treeWalk.release
} else { } else {
val parent = revWalk.parseCommit(commit.getParent(0).getId()) (0 to commit.getParentCount - 1).foreach { i =>
val parent = revWalk.parseCommit(commit.getParent(i).getId())
val df = new DiffFormatter(DisabledOutputStream.INSTANCE) val df = new DiffFormatter(DisabledOutputStream.INSTANCE)
df.setRepository(git.getRepository) df.setRepository(git.getRepository)
df.setDiffComparator(RawTextComparator.DEFAULT) df.setDiffComparator(RawTextComparator.DEFAULT)
@@ -326,6 +329,7 @@ object JGitUtil {
} }
} }
} }
}
revWalk.release revWalk.release
} }