Skip to content

Commit

Permalink
Merge pull request #519 from codacy/fix/last-repo-file-ALA-1387
Browse files Browse the repository at this point in the history
fix: fixes extraction of repository files ALA-1387
  • Loading branch information
pedrobpereira authored Jan 30, 2025
2 parents 7f08687 + 2244792 commit cbe80ad
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import org.eclipse.jgit.lib.{Repository, RepositoryBuilder}
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.treewalk.TreeWalk

import scala.jdk.CollectionConverters._
import scala.collection.mutable.ListBuffer
import scala.jdk.CollectionConverters.*
import scala.util.Try

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

val result: Seq[String] =
if (treeWalk.next) {
LazyList
.continually(treeWalk.getPathString)
.takeWhile(_ => treeWalk.next)
} else Seq.empty
val buffer = new ListBuffer[String]

result
while (treeWalk.next) {
buffer.addOne(treeWalk.getPathString)
}
buffer.toList
}
}

Expand Down

0 comments on commit cbe80ad

Please sign in to comment.