File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/GitVersion.Core.Tests/IntegrationTests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 66using GitVersion . VersionCalculation ;
77using LibGit2Sharp ;
88using NUnit . Framework ;
9+ using Shouldly ;
910
1011namespace GitVersion . Core . Tests . IntegrationTests ;
1112
@@ -225,6 +226,32 @@ public void MainVersioningContinuesCountingAfterMergingTheSameReleaseBranchMulti
225226 fixture . AssertFullSemver ( "2.0.0+5" ) ;
226227 }
227228
229+ [ Test ]
230+ public void ShouldUseTagsAsVersionSourceWhenPossible ( )
231+ {
232+ using var fixture = new EmptyRepositoryFixture ( ) ;
233+ fixture . Repository . MakeATaggedCommit ( "0.1.0" ) ;
234+ fixture . Checkout ( MainBranch ) ;
235+ fixture . Repository . CreateBranch ( "develop" ) ;
236+ fixture . Checkout ( "develop" ) ;
237+ fixture . MakeACommit ( "Feature commit 1" ) ;
238+ fixture . BranchTo ( "release/0.2.0" ) ;
239+ fixture . MakeACommit ( "Release commit 1" ) ;
240+ fixture . Checkout ( MainBranch ) ;
241+ fixture . MergeNoFF ( "release/0.2.0" ) ;
242+ fixture . ApplyTag ( "0.2.0" ) ;
243+
244+ var tag = fixture . Repository . Head . Tip ;
245+
246+ fixture . Checkout ( "develop" ) ;
247+ fixture . MergeNoFF ( MainBranch ) ;
248+
249+ fixture . AssertFullSemver ( "0.3.0-alpha.1" ) ;
250+
251+ var version = fixture . GetVersion ( ) ;
252+ version . VersionSourceSha . ShouldBeEquivalentTo ( tag . Sha ) ;
253+ }
254+
228255 [ Test ]
229256 public void WhenReleaseBranchIsMergedIntoDevelopHighestVersionIsTakenWithIt ( )
230257 {
You can’t perform that action at this time.
0 commit comments