Skip to content

Commit

Permalink
Faster way to count git commits
Browse files Browse the repository at this point in the history
Thanks to @agemooij
  • Loading branch information
raboof committed Jul 3, 2018
1 parent c73aafe commit 76377f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/sbtdynver/DynVerPlugin.scala
Expand Up @@ -155,9 +155,9 @@ sealed case class DynVer(wd: Option[File]) {
def hasNoTags(): Boolean = getGitDescribeOutput(new Date).hasNoTags

def getDistanceToFirstCommit() = {
val process = scala.sys.process.Process(s"git log --pretty=oneline --abbrev-commit", wd)
val process = scala.sys.process.Process(s"git rev-list --count HEAD", wd)
Try(process !! impl.NoProcessLogger).toOption
.map(_.split("\n").count(_.nonEmpty))
.map(_.trim.toInt)
}

def getGitDescribeOutput(d: Date) = {
Expand Down

0 comments on commit 76377f6

Please sign in to comment.