Comments (8)
It works for me with the following build.sbt
lazy val special = project.in(file("."))
.enablePlugins(GitVersioning, GitBranchPrompt)
.settings(
git.gitTagToVersionNumber := { tag: String =>
Some("special_tag")
}
)
Then I get:
special(master)> git tag
[info] v0.1
special(master)> show version
[info] special_tag
Are you using windows? What version of sbt and sbt-git are you pointing to?
And have you reloaded sbt after the tag was created?
from sbt-git.
Okay, I think I see the problem. I was not originally forthcoming with the entire scope of the issue apparently. My original project is a multi-module project in which I share settings across multiple modules. I tried to simplify the example but I should have done a more exhaustive test. When I created a simple single project with a git tag, it worked as you have pointed out. If it add submodules as additional projects, it will continue to work UNLESS I 'enablePlugins' in one of the submodules, which causes it to reset my git-related settings under the context of that submodule. My original project uses shared settings and that was the root of my problem. Ultimately my ignorance of how sbt loads plugins proliferated this misconception. I should have reconstructed the issue from scratch before submitting it and I would have realized the mistake. Thank you for responding to this issue, and I'm sorry for wasting your time!
from sbt-git.
No problem, glad you've solved your issue!
from sbt-git.
Seems I spoke too soon. I tried out this project: https://github.com/mjcramer/sbt-git-test
and here's the output:
~/projects/data/sbt-git-test] (master^) sbt
[info] Loading global plugins from /Users/michael.cramer/.sbt/0.13/plugins
[info] Loading project definition from /Users/michael.cramer/projects/data/sbt-git-test/project
[info] Updating {file:/Users/michael.cramer/projects/data/sbt-git-test/project/}sbt-git-test-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to special (in build file:/Users/michael.cramer/projects/data/sbt-git-test/)
special(master)> show version
[info] 95322edc77ad4127956bd2b9ca6bfb4ceb3afbba
special(master)> git tag
[info] v1.0
special(master)> git branch
[info] * master
special(master)> exit
from sbt-git.
Now it's back to just printing the sha hash while ignoring my git tag...
from sbt-git.
The behavior came back shortly after I added a "develop" branch to my other project. Now I cannot get it to work at all, even after rolling back all my changes. I dunno if that has anything to do with it, but I'm just throwing it out there...
from sbt-git.
Your problem is that there is no tag associated with HEAD.
Your v1.0 tag points at some other commit:
special(master)> git show v1.0
[info] commit d76e631bfd524849266f25dcd328883e83be0af4
[info] Author: Michael Cramer <[email protected]>
[info] Date: Tue Apr 7 09:27:04 2015 -0700
[info]
[info] init
[info]
You can see the tags associated with HEAD commit in sbt:
special(master)> show git-current-tags
[info] List()
if you create a new tag pointing at HEAD, everything comes back into order:
special(master)> git tag v2.0
special(master)> reload
special(master)> show git-current-tags
[info] List(v2.0)
special(master)> show version
[info] v2.0-special
from sbt-git.
Ahhhhhh!!! Thanks so much!
from sbt-git.
Related Issues (20)
- sbt-git seems abandoned HOT 6
- Volunteer needed to add CI using GitHub Actions
- Volunteer needed to add publishing via sbt-ci-release
- Drop sbt 0.13 from the crossbuild HOT 7
- gitRemoteRepo is not defined
- Multiple labeled tags leads to NumberFormatException during project load HOT 3
- Wrong output in generated `scmInfo` HOT 2
- Allow different tag patterns for multi-module projects using git describe
- Move to com.github.sbt? HOT 9
- Enable Scala Steward in this repo HOT 2
- Rename `master` to `main`
- Update repo secrets for Sonatype org change HOT 2
- Require Java 11 HOT 5
- Plan next release HOT 13
- Change package to `com.github.sbt.git`? HOT 6
- Typo in README: `gitTagToVersionNumberSetting`
- No version after 1.0.0 works HOT 2
- sbt-git v2.0.1: wrong version value returned
- sbt-git v2.0.1 disables all ouput from git commands to sbt logs HOT 5
- sbt-git v2.0.1: version number from "git describe" is not correct
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt-git.