@@ -75,6 +75,8 @@ public void FeatureFromMainBranch(bool withPullRequestIntoMain)
75
75
fixture . SequenceDiagram . Activate ( "main" ) ;
76
76
fixture . MakeACommit ( ) ;
77
77
fixture . AssertFullSemver ( "2.0.0-6" , configuration ) ;
78
+ fixture . ApplyTag ( "2.0.0" ) ;
79
+ fixture . AssertFullSemver ( "2.0.0" , configuration ) ;
78
80
}
79
81
80
82
[ TestCase ( false ) ]
@@ -233,6 +235,94 @@ public void FeatureFromDevelopBranch(bool withPullRequestIntoDevelop)
233
235
fixture . AssertFullSemver ( "2.1.0-alpha.7" , configuration ) ;
234
236
}
235
237
238
+ [ TestCase ( false ) ]
239
+ [ TestCase ( true ) ]
240
+ public void FeatureFromDevelopBranchWithMainline ( bool withPullRequestIntoDevelop )
241
+ {
242
+ var configuration = GitFlowConfigurationBuilder . New
243
+ . WithNextVersion ( "1.2.0" )
244
+ . WithVersionStrategies ( VersionStrategies . ConfiguredNextVersion , VersionStrategies . Mainline )
245
+ . WithBranch ( "feature" , _ => _ . WithIncrement ( IncrementStrategy . Minor ) )
246
+ . Build ( ) ;
247
+
248
+ using var fixture = new EmptyRepositoryFixture ( ) ;
249
+
250
+ fixture . SequenceDiagram . Participant ( "main" ) ;
251
+ fixture . SequenceDiagram . Participant ( "develop" ) ;
252
+
253
+ // GitFlow setup
254
+ fixture . SequenceDiagram . Activate ( "main" ) ;
255
+ fixture . Repository . MakeACommit ( ) ;
256
+ fixture . ApplyTag ( "1.2.0" ) ;
257
+ fixture . AssertFullSemver ( "1.2.0" , configuration ) ;
258
+
259
+ // Branch from main to develop
260
+ fixture . BranchTo ( "develop" , "develop" ) ;
261
+ fixture . SequenceDiagram . Activate ( "develop" ) ;
262
+ fixture . SequenceDiagram . Deactivate ( "main" ) ;
263
+ fixture . AssertFullSemver ( "1.3.0-alpha.0" , configuration ) ;
264
+
265
+ // Branch from develop to feature
266
+ const string branchName = "feature/foo" ;
267
+ fixture . BranchTo ( branchName , "feature" ) ;
268
+ fixture . SequenceDiagram . Activate ( "feature" ) ;
269
+ fixture . SequenceDiagram . Deactivate ( "develop" ) ;
270
+ fixture . AssertFullSemver ( "1.3.0-foo.1+0" , configuration ) ;
271
+ fixture . MakeACommit ( ) ;
272
+ fixture . AssertFullSemver ( "1.3.0-foo.1+1" , configuration ) ;
273
+
274
+ // Create hotfix on main branch
275
+ fixture . Checkout ( "main" ) ;
276
+ fixture . SequenceDiagram . Activate ( "main" ) ;
277
+ fixture . MakeACommit ( "+semver: minor" ) ;
278
+ fixture . AssertFullSemver ( "1.3.0-1" , configuration ) ;
279
+
280
+ // Merge main to develop branch
281
+ fixture . MergeTo ( "develop" ) ;
282
+ fixture . SequenceDiagram . Deactivate ( "main" ) ;
283
+ fixture . SequenceDiagram . Activate ( "develop" ) ;
284
+ fixture . AssertFullSemver ( "1.4.0-alpha.1" , configuration ) ;
285
+
286
+ // Merge develop to feature branch
287
+ fixture . Checkout ( "main" ) ;
288
+ fixture . MergeTo ( branchName ) ;
289
+ fixture . SequenceDiagram . Deactivate ( "develop" ) ;
290
+ fixture . AssertFullSemver ( "1.4.0-foo.1+2" , configuration ) ;
291
+
292
+ // Bump to major version increment
293
+ fixture . MakeACommit ( "+semver: major" ) ;
294
+ fixture . AssertFullSemver ( "2.0.0-foo.1+3" , configuration ) ;
295
+
296
+ // Create pre-release on feature branch
297
+ fixture . ApplyTag ( "2.1.0-foo.1" ) ;
298
+ fixture . AssertFullSemver ( "2.1.0-foo.2+0" , configuration ) ;
299
+ fixture . MakeACommit ( ) ;
300
+ fixture . AssertFullSemver ( "2.1.0-foo.2+1" , configuration ) ;
301
+ fixture . Checkout ( "develop" ) ;
302
+
303
+ if ( withPullRequestIntoDevelop )
304
+ {
305
+ // Create a PullRequest into develop
306
+ fixture . BranchTo ( "pull/2/merge" , "pull" ) ;
307
+ fixture . SequenceDiagram . Activate ( "pull/2/merge" ) ;
308
+ fixture . MergeNoFF ( branchName ) ;
309
+ fixture . AssertFullSemver ( "2.1.0-PullRequest2.6" , configuration ) ;
310
+ fixture . Checkout ( "develop" ) ;
311
+ fixture . Remove ( "pull/2/merge" ) ;
312
+ }
313
+
314
+ // Merge feature into develop branch
315
+ fixture . MergeNoFF ( branchName ) ;
316
+ fixture . Remove ( branchName ) ;
317
+ fixture . SequenceDiagram . NoteOver ( "Feature branches should\r \n be deleted once merged" , branchName ) ;
318
+ fixture . AssertFullSemver ( "2.1.0-alpha.6" , configuration ) ;
319
+
320
+ // Commit on develop branch
321
+ fixture . SequenceDiagram . Activate ( "develop" ) ;
322
+ fixture . MakeACommit ( ) ;
323
+ fixture . AssertFullSemver ( "2.1.0-alpha.7" , configuration ) ;
324
+ }
325
+
236
326
[ TestCase ( false ) ]
237
327
[ TestCase ( true ) ]
238
328
public void HotfixBranch ( bool withPullRequestIntoMain )
@@ -301,6 +391,8 @@ public void HotfixBranch(bool withPullRequestIntoMain)
301
391
fixture . SequenceDiagram . Activate ( "main" ) ;
302
392
fixture . MakeACommit ( ) ;
303
393
fixture . AssertFullSemver ( "2.0.0-6" , configuration ) ;
394
+ fixture . ApplyTag ( "2.0.0" ) ;
395
+ fixture . AssertFullSemver ( "2.0.0" , configuration ) ;
304
396
}
305
397
306
398
[ TestCase ( false ) ]
@@ -442,6 +534,8 @@ public void VersionedHotfixBranch(bool withPullRequestIntoMain)
442
534
fixture . SequenceDiagram . Activate ( "main" ) ;
443
535
fixture . MakeACommit ( ) ;
444
536
fixture . AssertFullSemver ( "3.0.1-6" , configuration ) ;
537
+ fixture . ApplyTag ( "3.0.1" ) ;
538
+ fixture . AssertFullSemver ( "3.0.1" , configuration ) ;
445
539
}
446
540
447
541
[ TestCase ( false ) ]
@@ -583,6 +677,8 @@ public void ReleaseBranch(bool withPullRequestIntoMain)
583
677
fixture . SequenceDiagram . Activate ( "main" ) ;
584
678
fixture . MakeACommit ( ) ;
585
679
fixture . AssertFullSemver ( "2.0.1-6" , configuration ) ;
680
+ fixture . ApplyTag ( "2.0.1" ) ;
681
+ fixture . AssertFullSemver ( "2.0.1" , configuration ) ;
586
682
}
587
683
588
684
[ TestCase ( false ) ]
@@ -724,6 +820,8 @@ public void VersionedReleaseBranch(bool withPullRequestIntoMain)
724
820
fixture . SequenceDiagram . Activate ( "main" ) ;
725
821
fixture . MakeACommit ( ) ;
726
822
fixture . AssertFullSemver ( "3.0.1-6" , configuration ) ;
823
+ fixture . ApplyTag ( "3.0.1" ) ;
824
+ fixture . AssertFullSemver ( "3.0.1" , configuration ) ;
727
825
}
728
826
729
827
[ TestCase ( false ) ]
@@ -852,13 +950,15 @@ public void DevelopBranch(bool withPullRequestIntoMain)
852
950
// Create hotfix on main branch
853
951
fixture . MakeACommit ( ) ;
854
952
fixture . AssertFullSemver ( "1.3.1-1" , configuration ) ;
953
+ fixture . ApplyTag ( "1.3.1" ) ;
954
+ fixture . AssertFullSemver ( "1.3.1" , configuration ) ;
855
955
856
956
// Merge main to release branch
857
957
fixture . MergeTo ( branchName ) ;
858
958
fixture . SequenceDiagram . Deactivate ( "main" ) ;
859
- fixture . AssertFullSemver ( "1.4.0-alpha.3 " , configuration ) ;
959
+ fixture . AssertFullSemver ( "1.4.0-alpha.2 " , configuration ) ;
860
960
fixture . MakeACommit ( "+semver: major" ) ;
861
- fixture . AssertFullSemver ( "2.0.0-alpha.4 " , configuration ) ;
961
+ fixture . AssertFullSemver ( "2.0.0-alpha.3 " , configuration ) ;
862
962
863
963
// Create pre-release on release branch
864
964
fixture . ApplyTag ( "2.1.0-alpha.1" ) ;
@@ -873,20 +973,22 @@ public void DevelopBranch(bool withPullRequestIntoMain)
873
973
fixture . BranchTo ( "pull/2/merge" , "pull" ) ;
874
974
fixture . SequenceDiagram . Activate ( "pull/2/merge" ) ;
875
975
fixture . MergeNoFF ( branchName ) ;
876
- fixture . AssertFullSemver ( "2.1.0-PullRequest2.6 " , configuration ) ;
976
+ fixture . AssertFullSemver ( "2.1.0-PullRequest2.5 " , configuration ) ;
877
977
fixture . Checkout ( "main" ) ;
878
978
fixture . Remove ( "pull/2/merge" ) ;
879
979
}
880
980
881
981
// Merge develop into main branch
882
982
fixture . MergeNoFF ( branchName ) ;
883
983
fixture . SequenceDiagram . Deactivate ( branchName ) ;
884
- fixture . AssertFullSemver ( "2.1.0-6 " , configuration ) ;
984
+ fixture . AssertFullSemver ( "2.1.0-5 " , configuration ) ;
885
985
886
986
// Commit on main branch
887
987
fixture . SequenceDiagram . Activate ( "main" ) ;
888
988
fixture . MakeACommit ( ) ;
889
- fixture . AssertFullSemver ( "2.1.0-7" , configuration ) ;
989
+ fixture . AssertFullSemver ( "2.1.0-6" , configuration ) ;
990
+ fixture . ApplyTag ( "2.1.0" ) ;
991
+ fixture . AssertFullSemver ( "2.1.0" , configuration ) ;
890
992
}
891
993
892
994
[ TestCase ( false ) ]
@@ -1057,10 +1159,14 @@ public void SupportBranch(bool withPullRequestIntoSupport)
1057
1159
fixture . Checkout ( "support/1.x" ) ;
1058
1160
fixture . MakeACommit ( ) ;
1059
1161
fixture . AssertFullSemver ( "1.2.4-1" , configuration ) ;
1162
+ fixture . ApplyTag ( "1.2.4" ) ;
1163
+ fixture . AssertFullSemver ( "1.2.4" , configuration ) ;
1060
1164
1061
1165
fixture . Checkout ( "main" ) ;
1062
1166
fixture . MergeNoFF ( "support/1.x" ) ;
1063
1167
fixture . AssertFullSemver ( "2.0.2-2" , configuration ) ;
1168
+ fixture . ApplyTag ( "2.0.2" ) ;
1169
+ fixture . AssertFullSemver ( "2.0.2" , configuration ) ;
1064
1170
}
1065
1171
1066
1172
[ TestCase ( false ) ]
0 commit comments