Skip to content

Commit e539f51

Browse files
committed
fix parsing git output
1 parent 31c9a30 commit e539f51

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/scala/GitInfo.scala

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ case class Commit(sha: String, author: String, header: String, body: String) {
88
object GitHelper {
99
val gitFormat = "--format=format:*-*%h``%aN``%s``%b"
1010
def processGitCommits(input: String): IndexedSeq[Commit] =
11-
((input split "[\\r\\n]*\\*\\-\\*").view map (_ split "``") collect {
11+
input.lines.map(_.split("``", 4)).collect {
1212
case Array(sha, author, hdr, msg) => Commit(sha, author, hdr, msg)
13-
}).toVector
13+
}.toVector
1414

1515
def hasFixins(msg: String): Boolean = (
1616
(msg contains "SI-") /*&& ((msg.toLowerCase contains "fix") || (msg.toLowerCase contains "close"))*/
@@ -34,10 +34,8 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
3434
import sys.process._
3535
import GitHelper._
3636

37-
def runGit =
38-
Process(Seq("git", "log", s"${previousTag}..${currentTag}","--format=format:*-*%h``%aN``%s``%b","--no-merges"), gitDir)
39-
val commits =
40-
processGitCommits(runGit.!!)
37+
def runGit = Process(Seq("git", "log", s"${previousTag}..${currentTag}","--format=format:%h``%aN``%s``%b","--no-merges"), gitDir)
38+
val commits = processGitCommits(runGit.!!)
4139

4240
val authors: Seq[(String, Int)] = {
4341
val grouped: Vector[(String,Int)] = (commits groupBy (_.author)).map { case (a,c) => a -> c.length }{collection.breakOut}

0 commit comments

Comments
 (0)