Wrong version when using git describe? #67

Closed
jakobgrunig opened this Issue Mar 19, 2015 · 5 comments

Projects

None yet

5 participants

@jakobgrunig

When I have git.useGitDescribe set to true I noticed the following:

  1. I tag HEAD to 'v0.8.0' and 'sbt version' returns '0.8.0'
  2. I commit something and 'sbt version' returns something like 'v0.8.0-1-gbeea47d'

Shouldn't this be '0.8.0-1-gbeea47d'?

@jsuereth
Member

probably, but I think we're using the "raw" git describe output. Would have to alter how we filter out the "v". Could be an easy fix if you're interested.

@charleskubicek

Our current work-around is to override the gitDescribedVersion setting:

git.gitDescribedVersion <<= git.gitDescribedVersion((v) => v.map(_.drop(1)))

@metasim
metasim commented May 20, 2015

Scratch that... didn't fix the problem like I thought. something indeed appears to be getting cached.

My git version is 2.2.0.

I was having a similar problem but fixed it with this:

git.gitTagToVersionNumber := { tag: String =>
  if(tag matches "v[0.9]+\\..*") Some(tag.drop(1))
  else None
}

Wondering if something is funky with the default git.gitTagToVersionNumber function.

@metasim
metasim commented May 20, 2015

If I combine charleskubicek 's solution with overriding git.gitTagToVersionNumber, I get the behavior I'd expect.:

git.gitDescribedVersion <<= git.gitDescribedVersion((v) => v.map(_.drop(1)))

git.gitTagToVersionNumber := { tag: String =>
  if(tag matches "v[0.9]+\\..*") Some(tag.drop(1))
  else None
}
@lrytz lrytz added a commit to lrytz/sbt-git that referenced this issue May 21, 2015
@lrytz lrytz fix for #67 fd0b5ce
@lrytz lrytz referenced this issue May 21, 2015
Merged

fix for #67 #88

@lrytz lrytz added a commit to lrytz/sbt-git that referenced this issue Jun 7, 2015
@lrytz lrytz fix for #67 87e0113
@lrytz lrytz added a commit to lrytz/sbt-git that referenced this issue Jun 8, 2015
@lrytz lrytz fix for #67 05df804
@lrytz lrytz added a commit to lrytz/sbt-git that referenced this issue Jun 8, 2015
@lrytz lrytz fix for #67 17a78d5
@fernandomora fernandomora added a commit to fernandomora/sbt-git that referenced this issue Jun 20, 2015
@fernandomora fernandomora Fix for #67 Use gitTagToVersionNumber also with git describe 15d8c17
@fernandomora fernandomora added a commit to fernandomora/sbt-git that referenced this issue Jun 20, 2015
@fernandomora fernandomora Fix for #67 Use gitTagToVersionNumber also with git describe 2ea733b
@fernandomora fernandomora added a commit to fernandomora/sbt-git that referenced this issue Jun 21, 2015
@fernandomora fernandomora Fix for #67 Use gitTagToVersionNumber also with git describe d6d1316
@dwijnand
Member

Fixed in #88

@dwijnand dwijnand closed this Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment