Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 15 2020 13:06
    arturcic unlabeled #2095
  • Jun 15 2020 13:05
    arturcic opened #2328
  • Jun 15 2020 08:09
    github-actions[bot] commented #2122
  • Jun 15 2020 08:09
    github-actions[bot] commented #2300
  • Jun 15 2020 08:09
    github-actions[bot] commented #2306
  • Jun 15 2020 08:09
    github-actions[bot] commented #2310
  • Jun 15 2020 08:09
    github-actions[bot] commented #2311
  • Jun 15 2020 08:09
    github-actions[bot] commented #2320
  • Jun 15 2020 08:09
    github-actions[bot] commented #2327
  • Jun 15 2020 07:49
    arturcic milestoned #2095
  • Jun 15 2020 07:49
    arturcic demilestoned #2095
  • Jun 15 2020 07:46

    arturcic on 5.3.6

    (compare)

  • Jun 15 2020 07:27
    arturcic demilestoned #2241
  • Jun 15 2020 07:27
    arturcic unassigned #2241
  • Jun 15 2020 07:27
    arturcic demilestoned #2074
  • Jun 15 2020 07:26
    arturcic milestoned #2327
  • Jun 15 2020 07:25
    arturcic demilestoned #2318
  • Jun 15 2020 07:25
    arturcic milestoned #2122
  • Jun 15 2020 07:25
    arturcic labeled #2122
  • Jun 15 2020 07:23
    arturcic demilestoned #2313
Gaute Løken
@gautelo
Seems hanging processes isn't actually the issue. I've found that if I delete everything under C:\Dev\ref\GitVersion\src\GitVersion.App.Tests\bin\Release\netcoreapp3.1\TestRepositories I can rerun the build (with tests still failing as before).
Gaute Løken
@gautelo
Attempted running in a 32 bit powershell, but same results.
cedricmendelin
@cedricmendelin
Hey guys
I started using gitversion and the tools looks really promising. Still I am a little bit struggling with integration. So we are using AzureDevops and we hat that .NETStandard2.0 and .NETFramework 4.72 Solution (Visual Studio Extension). The Task for Buildpipeline is working fine but I would also like to have versioning on a local build. I start using the Nuget Packages but the only thing which is working is the depricated GitVersionTask nuget Package, the newer ones also throw errors during builds.
Am I doing something wrong or is the gitversion tool not suited for the given setup with .NETStandard 2.0 and net472?
Gaute Løken
@gautelo
Just wanna pop by again, to say thanks for the excellent IntegrationTests. They do a very good job of communicating intent. Thanks! <3
Gaute Løken
@gautelo
The cli has a /config option, is there a similar option for the msbuild tasks? A build property perhaps?
Gaute Løken
@gautelo
In my case I just wanted to go one folder out, so the following workaround worked for me:
  <Target Name="SetGitVersionConfigFile" BeforeTargets="RunGitVersion" Condition="!$(GitVersion_ToolArgments.Contains('-config'))">
    <PropertyGroup >
        <GitVersion_ToolArgments>$(GitVersion_ToolArgments) -config ../GitVersion.yml</GitVersion_ToolArgments>
    </PropertyGroup>
    <Message Text="GitVersion_ToolArgments: $(GitVersion_ToolArgments)" Importance="high" />
  </Target>
James P Chadwick
@jamespchadwick

Hi all! Doing a little weekend experimentation with GitVersion to start implemeting Semantic Versioning in my projects. I took one of my projects and added GitVersion to the csproj file using:

dotnet add package GitVersion.CommandLine --version 5.6.8

I can see that the package reference has been included in my .csproj file:

    <PackageReference Include="GitVersion.CommandLine" Version="5.6.8">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>

But when I try to invoke GitVersion in the command line I get an error saying its not a recognized. I've tried tons of different variations and none of them work.

> gitversion
>gitversion.exe
>dotnet-gitversion
>dotnet-gitversion.exe

I wanted to go this route as opposed to installing it as a global tool because I'd eventually like to use the same scripts to build and release on my local machine and on my CI/CD server and I dont want to have to remember to install something globally every time I start working on a new machine or a I add a new developer to my project

Anyone have any insights or suggestions? Is using GitVersion non-globally even a supported options?

David Keaveny
@davidkeaveny
Has anyone tried using the GitVersion metarunner with TeamCity Cloud Beta? If I generate the version number in TeamCity on-premise, then everything works fine; if I try to generate the version number against the same repo/branch in TeamCity Cloud Beta, I get the following exception:
 System.NullReferenceException: Object reference not set to an instance of an object.
       at GitVersion.GitObject..ctor(GitObject innerGitObject)
       at GitVersion.Commit..ctor(Commit innerCommit)
       at GitVersion.GitRepository.<>c__DisplayClass27_0.<FindMergeBase>b__0()
       at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
       at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
       at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
       at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
       at Polly.Policy`1.Execute(Func`1 action)
       at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation)
       at GitVersion.GitRepository.FindMergeBase(ICommit commit, ICommit otherCommit)
       at GitVersion.RepositoryStore.FindMergeBase(ICommit commit, ICommit mainlineTip)
       at GitVersion.VersionCalculation.BaseVersionCalculator.FixTheBaseVersionSourceOfMergeMessageStrategyIfReleaseBranchWasMergedAndDeleted(IEnumerable`1 baseVersions)
       at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersion()
       at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion()
       at GitVersion.GitVersionCalculateTool.CalculateVersionVariables()
       at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions)
The Sharp Ninja
@sharpninja
@davidkeaveny I have the same problem on Azure DevOps
INFO [04/24/21 14:46:13:84] Dumping commit graph: 
INFO [04/24/21 14:46:13:87] * 83e0c0f 6 minutes ago  (HEAD -> azure-pipelines, origin/azure-pipelines, origin/83e0c0fd2ea6f5822dc53f79d34be2dd20293841, 83e0c0fd2ea6f5822dc53f79d34be2dd20293841)
* 677a190 70 minutes ago  (677a190f3574bf4f648ec096c2aa8c6cf2da5c97)
*   f38a4b8 77 minutes ago  (f38a4b84b9a4256c61641145b49ee83e298de00d)
|\  
| * 50977fb 79 minutes ago  (origin/main, main)
* | 3f93c73 77 minutes ago  (3f93c73e6ae856bf1fb512c7a790641717506a47)
* | 1f6632c 82 minutes ago  (1f6632c3f41ff79ad56dd8f1b56e0a40a49ed510)
|\| 
| * 1593c4a 84 minutes ago 
* | 64363c1 2 hours ago  (64363c1681b10b92c1bcff4eef888e1cdef0b295)
* | 615b05d 2 hours ago 
* | 4c3a9fa 2 hours ago  (4c3a9fa836a1c194c9205390f33fd250e2945cc5)
* | 899f173 2 hours ago 
* | 2049b32 2 hours ago 
|\| 
| * 0ebb401 2 hours ago 
* | e70e48e 2 hours ago 
|\| 
| * c345bde 5 hours ago 
| * 675de41 20 hours ago 
| * 8788539 20 hours ago 
* | 880d261 2 hours ago 
* | c524cdc 2 hours ago 
* | f23302e 2 days ago 
|/  
* c5fec36 2 days ago 
* b7772ab 2 days ago 
* d7cc1bb 2 days ago 
* ae9d7d4 2 days ago  (origin/master, master)

INFO [04/24/21 14:46:13:87] Working directory: /home/ninja/myagent/_work/1/s
INFO [04/24/21 14:46:13:89] Project root is: /home/ninja/myagent/_work/1/s/
INFO [04/24/21 14:46:13:89] DotGit directory is: /home/ninja/myagent/_work/1/s/.git
INFO [04/24/21 14:46:13:98] Using latest commit on specified branch
INFO [04/24/21 14:46:13:99] No branch configuration found for branch azure-pipelines, falling back to default configuration
INFO [04/24/21 14:46:13:99] Begin: Attempting to inherit branch configuration from parent branch
  INFO [04/24/21 14:46:14:00] Begin: Finding branch source of 'azure-pipelines'
    INFO [04/24/21 14:46:14:01] Begin: Finding merge base between 'azure-pipelines' and 'main'.
      INFO [04/24/21 14:46:14:02] Found merge base of 50977fb Killed package lock.
      INFO [04/24/21 14:46:14:02] Merge base of azure-pipelines' and 'main is 50977fb Killed package lock.
    INFO [04/24/21 14:46:14:03] End: Finding merge base between 'azure-pipelines' and 'main'. (Took: 14.69ms)
    INFO [04/24/21 14:46:14:03] Begin: Finding merge base between 'azure-pipelines' and 'master'.
    INFO [04/24/21 14:46:14:03] End: Finding merge base between 'azure-pipelines' and 'master'. (Took: 1.40ms)
  INFO [04/24/21 14:46:14:03] End: Finding branch source of 'azure-pipelines' (Took: 24.34ms)
  INFO [04/24/21 14:46:14:03] End: Attempting to inherit branch configuration from parent branch (Took: 34.42ms)
  INFO [04/24/21 14:46:14:04] Attempting to show the current git graph (please include in issue): 
  INFO [04/24/21 14:46:14:04] Showing max of 100 commits
  INFO [04/24/21 14:46:14:04] * 83e0c0f 6 minutes ago  (HEAD -> azure-pipelines, origin/azure-pipelines, origin/83e0c0fd2ea6f5822dc53f79d34be2dd20293841, 83e0c0fd2ea6f5822dc53f79d34be2dd20293841)
* 677a190 70 minutes ago  (677a190f3574bf4f648ec096c2aa8c6cf2da5c97)
*   f38a4b8 77 minutes ago  (f38a4b84b9a4256c61641145b49ee83e298de00d)
|\  
| * 50977fb 79 minutes ago  (origin/main, main)
* | 3f93c73 77 minutes ago  (3f93c73e6ae856bf1fb512c7a790641717506a47)
* | 1f6632c 82 minutes ago  (1f6632c3f41ff79ad56dd8f1b56e0a40a49ed510)
|\| 
| * 1593c4a 84 minutes ago 
* | 64363c1 2 hours ago  (64363c1681b10b92c1bcff4eef888e1cdef0b295)
* | 615b05d 2 hours ago 
* | 4c3a9fa 2 hours ago  (4c3a9fa836a1c194c9205390f33fd250e2945cc5)
* | 899f173 2 hours ago 
* | 2049b32 2 hours ago 
|\| 
| * 0ebb401 2 hours ago 
* | e70e48e 2 hours ago 
|\| 
| * c345bde 5 hours ago 
| * 675de41 20 hours ago 
| * 8788539 20 hours ago 
* | 880d261 2 hours ago 
* | c524cdc 2 hours ago 
* | f23302e 2 days ago 
|/  
* c5fec36 2 days ago 
* b7772ab 2 days ago 
* d7cc1bb 2 days ago 
* ae9d7d4 2 days ago  (origin/master, master)

INFO [04/24/21 14:46:13:84] Dumping commit graph: 
INFO [04/24/21 14:46:13:87] * 83e0c0f 6 minutes ago  (HEAD -> azure-pipelines, origin/azure-pipelines, origin/83e0c0fd2ea6f5822dc53f79d34be2dd20293841,
Jim-with-a-J
@Jim-with-a-J
hi folks, I wonder if anyone can offer any suggestions as to why our build machine might return a different version to my dev machine. The server doesn't have a shallow clone. Both are using GitVersion 5.5.0 and they report identical configuration with /showconfig. They also report the exact same SHA as the version source :( The "server" (running Windows 7) returns 5.1.0 while my machine (Windows 10) returns 5.0.16
Gary Ewan Park
@gep13
@Jim-with-a-J can I suggest that you run gitversion /diag on both machines? This should provide additional information about "how" the version number was asserted on both machines, and from there, it will hopefully guide you in the right direction.
Jim-with-a-J
@Jim-with-a-J
@gep13 thanks, I have actually just been looking at a diff of /diag from both machines. It starts diverging almost immediately - both say HEAD is a merge commit and likely a pull request, but they both pick a different branch as the likely base for it
(the commit in question merges from master into the branch we're trying to build, but the build VM sees this as using master as the base, while my machine sees the opposite). I'm not sure if this matters, I'm still at the start of the logs
Gary Ewan Park
@gep13
@Jim-with-a-J which CI system are you running on? Are you running the exact same gitversion command locally as on the server, or are you using the /output buildserver option?
Jim-with-a-J
@Jim-with-a-J
To investigate this problem, I'm running the exact same command on both machines manually, /diag is the only parameter.
Gary Ewan Park
@gep13
And just to confirm, have you deleted the cached version of the asserted version number from within the .git folder? This may causes problems if not cleared out
Jim-with-a-J
@Jim-with-a-J
this is not something I have done in the past, should I just delete the entire gitversion_cache folder?
(dinner time here, thanks for your help and I will get back with results a little later)
Gary Ewan Park
@gep13
There is no harm in doing that. GitVersion will put these files back if/when needed. Clearing them out on both machines will mean that you are getting the same execution each time (assuming that the history/state of the repository is the same on each machine)
Jim-with-a-J
@Jim-with-a-J
thanks @gep13, clearing out the cache didn't make a difference, but I tried a fresh clone on both systems, and now my version matches the server's. I guess my repository has some cobwebs from a lifetime of abuse :)
Gary Ewan Park
@gep13

Depending on how GitVersion is invoked, it can make some changes to the repository (a process known as normalization) where it attempts to ensure that all required information (commits, tags, etc) are present in the local clone.

Glad to hear that you got it working though!

Alessandro Surace
@zioalex_gitlab
Hi All
Looks like I am not able to raise the major/minor/patch version when I like to do it.
I did with a commit message like this: "+semver: minor" in a feature branch but the minor is never updated.
I am running this locally and on Azure DevOps the result is the same.
This is the message of the feature build "#5.1.0-add-update-detection-stage.1+20 +semver: minor"
While this is then I merge to master:
"#5.1.0+24 Merged PR 833: Increase minor...Maybe"
Either way no minor increment.
Amaury Levé
@Evangelink
Hi there, I have just started to use gitversions and I have a question. I have initialized my yaml file as described in the documentation and set up the next version to 1.0.0. I have done a couple of PRs which get the expected version. I have then added a 1.0.0 tag to one of my commit and now gitversions mark the new build with v1.0.1+XXX is it expected? I would have been expecting to see v2.0.0 or v1.1.0.
Patrick B
@PatrickBig

Anyone have any idea why updating git version changed my versions so much?

Previously I was running 5.3.7
My app was reporting to be 0.4.14

I updated today to 5.6.9
Now it reports the version as 0.2.1

Here is my gitversion.yml
mode: Mainline
next-version: 0.2.1
branches: {}
ignore:
  sha: []
merge-message-formats: {}
It looks like it just resets everything to my 'next-version' property
Patrick B
@PatrickBig
Ok, it looks like it might have been previously counting changes against master instead of main
Any way I can easily change the branch name to master in the config?
Patrick B
@PatrickBig
Nevermind. Changed my branch to main and it still isn't working
{
  "Major": 0,
  "Minor": 2,
  "Patch": 1,
  "PreReleaseTag": "751",
  "PreReleaseTagWithDash": "",
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "WeightedPreReleaseNumber": 60000,
  "BuildMetaData": null,
  "BuildMetaDataPadded": "",
  "FullBuildMetaData": "Branch.main.Sha.8e4422fa08dafca389e35409b667968cbdebd972",
  "MajorMinorPatch": "0.2.1",
  "SemVer": "0.2.1",
  "LegacySemVer": "0.2.1",
  "LegacySemVerPadded": "0.2.1",
  "AssemblySemVer": "0.2.1.0",
  "AssemblySemFileVer": "0.2.1.0",
  "FullSemVer": "0.2.1",
  "InformationalVersion": "0.2.1+Branch.main.Sha.8e4422fa08dafca389e35409b667968cbdebd972",
  "BranchName": "main",
  "EscapedBranchName": "main",
  "Sha": "8e4422fa08dafca389e35409b667968cbdebd972",
  "ShortSha": "8e4422f",
  "NuGetVersionV2": "0.2.1",
  "NuGetVersion": "0.2.1",
  "NuGetPreReleaseTagV2": "",
  "NuGetPreReleaseTag": "",
  "VersionSourceSha": "5ff1ca8733e4fcc1ad09dff89908bfd9ad485451",
  "CommitsSinceVersionSource": 751,
  "CommitsSinceVersionSourcePadded": "0751",
  "UncommittedChanges": 0,
  "CommitDate": "2021-05-17"
}
Output if that helps
Gary Ewan Park
@gep13
@PatrickBig if you haven't changed anything in the repository, i.e. you haven't made any new commits, you might be seeing an issue with a cached asserted version number. Go into the .git folder in the repository, and clear out the cached version numbers in there, and then try running GitVersion again.
Patrick B
@PatrickBig
@gep13 , nope. Same result :(
Gary Ewan Park
@gep13
if you run gitversion /diag, it should show "how" the version number is being calculated. That might provide some guidance as to what is happening here
Pedro Parra Ortega
@pedroparraortega
Hi guys, i’m trying to run gitversion on a Drone pipeline and I do get an error with
  ERROR [05/25/21 10:43:24:58] An unexpected error occurred:
LibGit2Sharp.LibGit2SharpException: No error message has been provided by the native library
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle remote, IEnumerable`1 refSpecs, GitFetchOptions fetchOptions, String logMessage)
   at LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable`1 refspecs, FetchOptions options, String logMessage)
   at GitVersion.GitRepository.<>c__DisplayClass33_0.<Fetch>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 199
   at GitVersion.RepositoryExtensions.RunSafe(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\RepositoryExtensions.cs:line 16
   at GitVersion.GitRepository.Fetch(String remote, IEnumerable`1 refSpecs, AuthenticationInfo auth, String logMessage) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 197
   at GitVersion.GitPreparer.<>c__DisplayClass17_1.<NormalizeGitDirectory>b__5() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 185
   at GitVersion.Helpers.RetryAction`1.<>c__DisplayClass1_0.<Execute>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 20
   at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
   at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
   at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`1 action)
   at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 42
   at GitVersion.Helpers.RetryAction`1.Execute(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 18
   at GitVersion.GitPreparer.NormalizeGitDirectory(Boolean noFetch, String currentBranchName, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 185
   at GitVersion.GitPreparer.NormalizeGitDirectory(String targetBranch, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 147
   at GitVersion.GitPreparer.PrepareInternal(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 77
   at GitVersion.GitPreparer.Prepare() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 59
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 43
   at GitVersion.GitVersionExecutor.Run
2 replies
Pedro Parra Ortega
@pedroparraortega
if I run the same docker image on my local it works, but when i run it from drone it fails with this error and no idea why. I do see in the pipeline logs that it is detecting somehow it is running on DRONE.
INFO [05/25/21 11:02:26:77] Applicable build agent found: 'Drone'.
INFO [05/25/21 11:02:26:80] Working directory: /drone/src
INFO [05/25/21 11:02:26:82] Branch from build environment: master
INFO [05/25/21 11:02:26:82] Project root is: /drone/src/
INFO [05/25/21 11:02:26:82] DotGit directory is: /drone/src/.git
INFO [05/25/21 11:02:26:82] Begin: Normalizing git directory for branch ‘master'
Tom
@ttutko
Hey everyone! My team recently upgraded azure devops server to the go live release of 2020.1 and now gitversion that is run using the docker image in our build pipeline is not returning any version numbers and complaining about being unable to determine the version from a detached head.
The thing is, Azure DevOps server/TFS has always used a detached head and this all worked before.
Any suggestions?
Pete Beegle
@petebeegle

Hey y'all!

I've recently been playing with gitversion, and I've encountered an issue that I can't figure out for the life of me. The issue originally cropped up in jenkins but I've been able to reproduce it locally. Basically, we've got a remote branch release/0.1.0 which is not present locally:

git branch -a

* dev
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master
  remotes/origin/release/0.1.0

With such a configuration, gitversion run against the dev branch returns 0.1.0-alpha.x where i would expect it to return 0.2.0-alpha.x.

Interestingly, if release/0.1.0 is present locally, then gitversion will return 0.2.0-alpha.x as expected.

It seems like I'm misunderstanding and would greatly appreciate any advice!

4 replies
Kevin Finnegan
@Kevinf63
Hi folks, regarding GitVersionTask the docs state "It currently works with desktop MSBuild. Support for CoreCLR with dotnet build is coming soon." To confirm, is this still the case and to be clear, does this mean dotnet build and publish of an app through Azure DevOps for instance is out of the question?
Daniel Rose
@DanielRose
I don't know about CoreCLR, but you could use the docker container
Mattias Karlsson
@devlead
GitVersion tool will work with .NET Core / 5 https://www.nuget.org/packages/GitVersion.Tool/
Yadel Lopez
@ylr-research
I have a SDK-like project, TF netstandard2.0. I want to try GitVersion and the docs say to add GitVersionTask pkg, but it says it's deprecated. Which package should I add?
rossdavidsmith
@rossdavidsmith

Hi, I've dug a hole for myself and I'm wondering if anyone has any advice.

I have accidentally included +semver: major in a merge commit message, which has bumped my version from 0.1.8 to 1.0.0, and I'm struggling to find a good way to recover from this.

I have tried:

  • Ignoring the commit by it's hash, and ignoring all commits prior to a date
    • I understand that this is because ignore "only ignores the commits for base version sourcing, not for version calculation"?
  • Setting commit-message-incrementing: Disabled(!)
    • This appears to have no effect. It feels like a bug.

What I don't want to do:

  • Force push to amend the offending commit.
    • While this is feasible at the moment (though painful), I need to know that I can fix this kind of issue in the future when it's not feasible.
  • Change the major-version-bump-message regex pattern.
    • While this works, it's not something I can repeat if the issue happens again.
3 replies
Kevin Finnegan
@Kevinf63
Hi folks, my team is looking to do "trunk development" with topic (feature, bugfix) branches. There will be no "release" branched from main, it will be manually git tagged and released to production, following the continuous delivery principle. Will I need to alter the gitversion config defaults to suit my needs?
Rob Smyth
@RobSmyth

Does anybody use GitVersion.CommandLine to version .NET Framework assemblies without changing AssemblyInfo.cs?

I have been using GitVersion.MsBuild and it provides versioning without changes to AssemblyInfo.cs.
However with the command line version I find I must use the update assemblyinfo option and edits the file meaning
that rebuilding results in a file change. I have tried a few combinations of moving common assembly info stuff to
AssemblyInfoBase.cs and tried to get the command line to generate the file ... but that failed.

Also an error is thrown if I add the command arg /updateassemblyinfofilename <filename>

Am I missing something?

Using GitVersion.CommandLine 5.6.10.

Rob Smyth
@RobSmyth
After scratching my head for an hour, I found out why just 2 minutes after above post :-). My bad, I failed to realise the dependencies between the command line options and that, of course, you cannot autodetect assembly info files and autogenerate, :-)
Hayden Hancock
@haydenhancock
I am using 'Mainline' and when I attempt to use +semver: major or +semver: patch in my PR title it doesn't seem to work. What's odd is that +semver: minor seems to work without issue. Am I doing something wrong?
1 reply
J.F. Larente
@jeanfrancoislarente

Apologies in advance for the long-ish post.

Gitversion: 5.6.10

We're getting a different result locally and in Azure Pipelines. In fact we're getting a stack trace in Azure Pipelines and locally everything is fine.

Gitversion is running against a Pull Request. I'll post additional details in thread...

GitVersion.yml:

Created a gist instead

Stack trace:

 ERROR [06/11/21 14:14:33:33] An unexpected error occurred:
System.NullReferenceException: Object reference not set to an instance of an object.
   at GitVersion.GitObject..ctor(GitObject innerGitObject) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitObject.cs:line 14
   at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 15
   at GitVersion.GitRepository.<>c__DisplayClass27_0.<FindMergeBase>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 60
   at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
   at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
   at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`1 action)
   at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 42
   at GitVersion.GitRepository.FindMergeBase(ICommit commit, ICommit otherCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 58
   at GitVersion.RepositoryStore.FindMergeBase(IBranch branch, IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 46
   at GitVersion.RepositoryStore.<>c__DisplayClass29_0.<GetMergeCommitsForBranch>b__2(IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 466
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.OrderedEnumerable`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.RepositoryStore.GetMergeCommitsForBranch(IBranch branch, Config configuration, IEnumerable`1 excludedBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 450
   at GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(IBranch branch, Config configuration, IBranch[] excludedBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 328
   at GitVersion.VersionCalculation.VersionInBranchNameVersionStrategy.GetVersions(String tagPrefixRegex, IBranch currentBranch)+MoveNext() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\BaseVersionCalculators\VersionInBranchNameVersionStrategy.cs:line 42
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)