Skip to content

Commit cbe80ad

Browse files
Merge pull request #519 from codacy/fix/last-repo-file-ALA-1387
fix: fixes extraction of repository files ALA-1387
2 parents 7f08687 + 2244792 commit cbe80ad

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

api-scala/src/main/scala/com/codacy/api/helpers/vcs/GitClient.scala

+7-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import org.eclipse.jgit.lib.{Repository, RepositoryBuilder}
77
import org.eclipse.jgit.revwalk.RevWalk
88
import org.eclipse.jgit.treewalk.TreeWalk
99

10-
import scala.jdk.CollectionConverters._
10+
import scala.collection.mutable.ListBuffer
11+
import scala.jdk.CollectionConverters.*
1112
import scala.util.Try
1213

1314
case class CommitInfo(uuid: String, authorName: String, authorEmail: String, date: Date)
@@ -51,14 +52,12 @@ class GitClient(workDirectory: File) {
5152
treeWalk.addTree(tree)
5253
treeWalk.setRecursive(true)
5354

54-
val result: Seq[String] =
55-
if (treeWalk.next) {
56-
LazyList
57-
.continually(treeWalk.getPathString)
58-
.takeWhile(_ => treeWalk.next)
59-
} else Seq.empty
55+
val buffer = new ListBuffer[String]
6056

61-
result
57+
while (treeWalk.next) {
58+
buffer.addOne(treeWalk.getPathString)
59+
}
60+
buffer.toList
6261
}
6362
}
6463

0 commit comments

Comments
 (0)