-
Notifications
You must be signed in to change notification settings - Fork 651
Is it possible to have the result of git rev-list --count in a variable? #1345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This particular variable is not, we have a similar variable which is BuildMetaData, but this counts the commits since the version changed. |
I see, thank you. Is there a way to call an external command in GitVersionTask or is the only possibility using GitVersion in a BeforeBuild task? |
Please note that putting something like a svn revision or As I was looking for a solution for strictly monotonic increasing version numbers (to satisfy Windows Installer's requirements for "Major Upgrades") in the |
Sorry for the late response. Yes, this does definitely help. In order to mitigate the 16 bit limitation pointed out by @jbaehr, it might be useful to use |
@chrbkr just be careful with GitVersion's cache. We run GitVersion.exe with the When you just set the env-var and only relies on GitVersionTask, you may have to find a way to tell the Task to ignore the cache (which will have a performance impact on large repos when building many projects). Or ensure the env-var is there in all cases. Finally just use your env-var in GitVersion's format strings, see the "*-format" keys in https://gitversion.readthedocs.io/en/stable/configuration/ |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
So I got kind of the same question. We are migrating an old project to use gitversion. However, this project was relying on git rev-list HEAD --count. Now I update the pipelines to rely on the PreReleaseNumber, however its far off the git count. Isn't there a way to PreReleaseNumber aligned ? Because at a point this prevent us from pushing application to store as the build number must be always higher than previous pushed build. |
Can't you use the build counter as a parameter in the version number then, @vincentcastagna? |
Hey @asbjornu can you elaborate please ? Where to get that build counter (you mean the git count ) ? |
You get that from the build system. TeamCity exposes a variable called |
@asbjornu any official doc about this variable ? Cause can't find. |
You will have to check with your build server. Which one do you use, @vincentcastagna? |
In our project, we switched from SVN to git. The versioning scheme was
<major>.<minor>.<patch>.<revision>
.For continuity, I wanted to keep this scheme, by getting the equivalent of the SVN revision via
git rev-list --count HEAD
.Is there a variable in GitVersion I can use for this? Or can this command be invoked in some other way when using GitVersionTask?
The text was updated successfully, but these errors were encountered: