Skip to content

Commit

Permalink
Merge pull request #74 from dwijnand/fasterCount
Browse files Browse the repository at this point in the history
Faster way to count git commits
  • Loading branch information
dwijnand authored Jul 3, 2018
2 parents c73aafe + 76377f6 commit 16c6ee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/sbtdynver/DynVerPlugin.scala
Original file line number Diff line number Diff line change
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 16c6ee8

Please sign in to comment.