@@ -278,6 +278,128 @@ public void HotfixBranchesWithTaggedCommitsOnHotfix()
278
278
fixture . AssertFullSemver ( "1.2.3" , configBumpMinor ) ;
279
279
}
280
280
281
+ [ Test ]
282
+ public void HotfixBranchesWithTaggedCommitsOnMain ( )
283
+ {
284
+ using var fixture = new EmptyRepositoryFixture ( ) ;
285
+ var configBumpMinor = new Config ( )
286
+ {
287
+ VersioningMode = VersioningMode . Mainline ,
288
+ Increment = IncrementStrategy . Minor ,
289
+ Branches =
290
+ {
291
+ {
292
+ Config . MainBranchKey ,
293
+ new BranchConfig
294
+ {
295
+ Regex = Config . MainBranchRegex ,
296
+ SourceBranches = new HashSet < string >
297
+ {
298
+ Config . DevelopBranchKey ,
299
+ Config . ReleaseBranchKey
300
+ } ,
301
+ Tag = string . Empty ,
302
+ PreventIncrementOfMergedBranchVersion = true ,
303
+ Increment = IncrementStrategy . Minor ,
304
+ IsMainline = true ,
305
+ PreReleaseWeight = 55000 ,
306
+ }
307
+ } ,
308
+ {
309
+ Config . HotfixBranchKey ,
310
+ new BranchConfig
311
+ {
312
+ Tag = ""
313
+ }
314
+ }
315
+ }
316
+ } ;
317
+
318
+ fixture . Repository . MakeACommit ( "1" ) ;
319
+ fixture . MakeATaggedCommit ( "1.0.0" ) ;
320
+
321
+ fixture . MakeACommit ( ) ; // 1.1.0
322
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
323
+ fixture . ApplyTag ( "1.1.0" ) ;
324
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
325
+
326
+ fixture . BranchTo ( "hotfix/may" ) ;
327
+ fixture . AssertFullSemver ( "1.1.1" , configBumpMinor ) ;
328
+
329
+ // Move main on
330
+ fixture . Checkout ( MainBranch ) ;
331
+ fixture . MakeACommit ( ) ;
332
+ fixture . AssertFullSemver ( "1.2.0" , configBumpMinor ) ;
333
+
334
+ // Continue on hotfix
335
+ fixture . Checkout ( "hotfix/may" ) ;
336
+ fixture . MakeACommit ( ) ; // 1.2.1
337
+ fixture . AssertFullSemver ( "1.1.1" , configBumpMinor ) ;
338
+ }
339
+
340
+ [ Test ]
341
+ public void HotfixBranchesWithTaggedCommitsOnHotfix ( )
342
+ {
343
+ using var fixture = new EmptyRepositoryFixture ( ) ;
344
+ var configBumpMinor = new Config ( )
345
+ {
346
+ VersioningMode = VersioningMode . Mainline ,
347
+ Increment = IncrementStrategy . Minor ,
348
+ Branches =
349
+ {
350
+ {
351
+ Config . MainBranchKey ,
352
+ new BranchConfig
353
+ {
354
+ Regex = Config . MainBranchRegex ,
355
+ SourceBranches = new HashSet < string >
356
+ {
357
+ Config . DevelopBranchKey ,
358
+ Config . ReleaseBranchKey
359
+ } ,
360
+ Tag = string . Empty ,
361
+ PreventIncrementOfMergedBranchVersion = true ,
362
+ Increment = IncrementStrategy . Minor ,
363
+ IsMainline = true ,
364
+ PreReleaseWeight = 55000 ,
365
+ }
366
+ } ,
367
+ {
368
+ Config . HotfixBranchKey ,
369
+ new BranchConfig
370
+ {
371
+ Tag = ""
372
+ }
373
+ }
374
+ }
375
+ } ;
376
+
377
+ fixture . Repository . MakeACommit ( "1" ) ;
378
+ fixture . MakeATaggedCommit ( "1.0.0" ) ;
379
+
380
+ fixture . MakeACommit ( ) ; // 1.1.0
381
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
382
+ fixture . ApplyTag ( "1.1.0" ) ;
383
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
384
+ fixture . MakeACommit ( ) ; // 1.2.0
385
+ fixture . AssertFullSemver ( "1.2.0" , configBumpMinor ) ;
386
+
387
+ fixture . BranchTo ( "hotfix/may" ) ;
388
+ fixture . AssertFullSemver ( "1.2.1" , configBumpMinor ) ;
389
+
390
+ // Move main on
391
+ fixture . Checkout ( MainBranch ) ;
392
+ fixture . MakeACommit ( ) ;
393
+ fixture . AssertFullSemver ( "1.3.0" , configBumpMinor ) ;
394
+
395
+ // Continue on hotfix
396
+ fixture . Checkout ( "hotfix/may" ) ;
397
+ fixture . MakeACommit ( ) ; // 1.2.1
398
+ fixture . MakeATaggedCommit ( "1.2.2" ) ;
399
+ fixture . MakeACommit ( ) ; // 1.2.3
400
+ fixture . AssertFullSemver ( "1.2.3" , configBumpMinor ) ;
401
+ }
402
+
281
403
[ Test ]
282
404
public void VerifyForwardMerge ( )
283
405
{
0 commit comments