File tree 2 files changed +36
-1
lines changed
GitVersionCore/VersionCalculation
GitVersionCore.Tests/IntegrationTests
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()
35
35
log . Info ( $ "Current commit is tagged with version { context . CurrentCommitTaggedVersion } , " +
36
36
"version calculation is for metadata only." ) ;
37
37
}
38
- EnsureHeadIsNotDetached ( context ) ;
38
+ else
39
+ {
40
+ EnsureHeadIsNotDetached ( context ) ;
41
+ }
39
42
40
43
SemanticVersion taggedSemanticVersion = null ;
41
44
You can’t perform that action at this time.
0 commit comments