Fix getAllcommitIds bug in empty repository

This commit is contained in:
Tomofumi Tanaka
2014-04-11 01:28:43 +09:00
parent 3f76453f34
commit 7b7c0e1eee

View File

@@ -573,7 +573,9 @@ object JGitUtil {
/** /**
* Returns all commit id in the specified repository. * Returns all commit id in the specified repository.
*/ */
def getAllCommitIds(git: Git): Seq[String] = { def getAllCommitIds(git: Git): Seq[String] = if(isEmpty(git)) {
Nil
} else {
val existIds = new scala.collection.mutable.ListBuffer[String]() val existIds = new scala.collection.mutable.ListBuffer[String]()
val i = git.log.all.call.iterator val i = git.log.all.call.iterator
while(i.hasNext){ while(i.hasNext){