File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
GitVersionCore.Tests/IntegrationTests
GitVersionCore/VersionCalculation Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1+ using GitTools . Testing ;
2+ using NUnit . Framework ;
3+
4+ namespace GitVersionCore . Tests . IntegrationTests
5+ {
6+ [ TestFixture ]
7+ public class TagCheckoutScenarios
8+ {
9+ [ Test ]
10+ public void GivenARepositoryWithSingleCommit ( )
11+ {
12+ using var fixture = new EmptyRepositoryFixture ( ) ;
13+ const string taggedVersion = "1.0.3" ;
14+ fixture . Repository . MakeATaggedCommit ( taggedVersion ) ;
15+ fixture . Checkout ( taggedVersion ) ;
16+
17+ fixture . AssertFullSemver ( taggedVersion ) ;
18+ }
19+
20+ [ Test ]
21+ public void GivenARepositoryWithSingleCommitAndSingleBranch ( )
22+ {
23+ using var fixture = new EmptyRepositoryFixture ( ) ;
24+ const string taggedVersion = "1.0.3" ;
25+ fixture . Repository . MakeATaggedCommit ( taggedVersion ) ;
26+ fixture . BranchTo ( "task1" ) ;
27+ fixture . Checkout ( taggedVersion ) ;
28+
29+ fixture . AssertFullSemver ( taggedVersion ) ;
30+ }
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ public SemanticVersion FindVersion()
3535 log . Info ( $ "Current commit is tagged with version { context . CurrentCommitTaggedVersion } , " +
3636 "version calculation is for metadata only." ) ;
3737 }
38- EnsureHeadIsNotDetached ( context ) ;
38+ else
39+ {
40+ EnsureHeadIsNotDetached ( context ) ;
41+ }
3942
4043 SemanticVersion taggedSemanticVersion = null ;
4144
You can’t perform that action at this time.
0 commit comments