1
+ using GitVersion . Configuration ;
1
2
using GitVersion . Core . Tests . Helpers ;
2
3
using LibGit2Sharp ;
3
4
@@ -6,6 +7,48 @@ namespace GitVersion.Core.Tests.IntegrationTests;
6
7
[ TestFixture ]
7
8
public class PullRequestScenarios : TestBase
8
9
{
10
+ /// <summary>
11
+ /// GitHubFlow - Pull requests (increment major on main and minor on feature)
12
+ /// </summary>
13
+ [ Test ]
14
+ public void EnsurePullRequestWithIncrementMajorOnMainAndMinorOnFeatureBranch ( )
15
+ {
16
+ var configuration = GitHubFlowConfigurationBuilder . New
17
+ . WithBranch ( "main" , _ => _
18
+ . WithIncrement ( IncrementStrategy . Major )
19
+ ) . WithBranch ( "feature" , _ => _
20
+ . WithIncrement ( IncrementStrategy . Minor )
21
+ ) . Build ( ) ;
22
+
23
+ using var fixture = new EmptyRepositoryFixture ( "main" ) ;
24
+
25
+ fixture . MakeACommit ( "A" ) ;
26
+
27
+ // ✅ succeeds as expected
28
+ fixture . AssertFullSemver ( "1.0.0-1" , configuration ) ;
29
+
30
+ fixture . ApplyTag ( "1.0.0" ) ;
31
+ fixture . BranchTo ( "feature/foo" ) ;
32
+ fixture . MakeACommit ( "B" ) ;
33
+
34
+ // ✅ succeeds as expected
35
+ fixture . AssertFullSemver ( "1.1.0-foo.1+1" , configuration ) ;
36
+
37
+ fixture . Checkout ( "main" ) ;
38
+ fixture . BranchTo ( "pull/2/merge" ) ;
39
+ fixture . MergeNoFF ( "feature/foo" ) ;
40
+
41
+ // ❌ expected: "2.0.0-PullRequest2.2"
42
+ fixture . AssertFullSemver ( "1.1.0-PullRequest2.2" , configuration ) ;
43
+
44
+ fixture . Checkout ( "main" ) ;
45
+ fixture . Remove ( "pull/2/merge" ) ;
46
+ fixture . MergeNoFF ( "feature/foo" ) ;
47
+
48
+ // ✅ succeeds as expected
49
+ fixture . AssertFullSemver ( "2.0.0-2" , configuration ) ;
50
+ }
51
+
9
52
[ Test ]
10
53
public void CanCalculatePullRequestChanges ( )
11
54
{
0 commit comments