1
+ namespace GitVersionCore . Tests . IntegrationTests . GitHubFlow
2
+ {
3
+ using GitVersion ;
4
+ using LibGit2Sharp ;
5
+ using NUnit . Framework ;
6
+
7
+ [ TestFixture ]
8
+ public class SupportBranchScenarios
9
+ {
10
+ [ Test ]
11
+ public void SupportIsCalculatedCorrectly ( )
12
+ {
13
+ using ( var fixture = new EmptyRepositoryFixture ( new Config ( ) ) )
14
+ {
15
+ // Start at 1.0.0
16
+ fixture . Repository . MakeACommit ( ) ;
17
+ fixture . Repository . ApplyTag ( "1.1.0" ) ;
18
+
19
+ // Create 2.0.0 release
20
+ fixture . Repository . CreateBranch ( "release-2.0.0" ) . Checkout ( ) ;
21
+ fixture . Repository . MakeCommits ( 2 ) ;
22
+
23
+ // Merge into develop and master
24
+ fixture . Repository . Checkout ( "master" ) ;
25
+ fixture . Repository . MergeNoFF ( "release-2.0.0" ) ;
26
+ fixture . Repository . ApplyTag ( "2.0.0" ) ;
27
+ fixture . AssertFullSemver ( "2.0.0+0" ) ;
28
+
29
+ // Now lets support 1.x release
30
+ fixture . Repository . Checkout ( "1.1.0" ) ;
31
+ fixture . Repository . CreateBranch ( "support/1.0.0" ) . Checkout ( ) ;
32
+ fixture . AssertFullSemver ( "1.1.0+0" ) ;
33
+
34
+ // Create release branch from support branch
35
+ fixture . Repository . CreateBranch ( "release/1.2.0" ) . Checkout ( ) ;
36
+ fixture . Repository . MakeACommit ( ) ;
37
+ fixture . AssertFullSemver ( "1.2.0-beta.1+1" ) ;
38
+
39
+ // Create 1.2.0 release
40
+ fixture . Repository . Checkout ( "support/1.0.0" ) ;
41
+ fixture . Repository . MergeNoFF ( "release/1.2.0" ) ;
42
+ fixture . AssertFullSemver ( "1.2.0+2" ) ;
43
+ fixture . Repository . ApplyTag ( "1.2.0" ) ;
44
+
45
+ // Create 1.2.1 hotfix
46
+ fixture . Repository . CreateBranch ( "hotfix/1.2.1" ) . Checkout ( ) ;
47
+ fixture . Repository . MakeACommit ( ) ;
48
+ fixture . AssertFullSemver ( "1.2.1+1" ) ;
49
+ fixture . Repository . Checkout ( "support/1.0.0" ) ;
50
+ fixture . Repository . MergeNoFF ( "hotfix/1.2.1" ) ;
51
+ fixture . AssertFullSemver ( "1.2.1+2" ) ;
52
+ }
53
+ }
54
+ }
55
+ }
0 commit comments