@@ -135,8 +135,9 @@ public void GivenTrunkBasedWorkflowWithIgnoreConfigurationBeforeCommitWithTagThe
135
135
fixture . ApplyTag ( "1.0.0" ) ;
136
136
fixture . MakeACommit ( "D" ) ;
137
137
138
+ var before = commitC . Committer . When . AddSeconds ( 1 ) ;
138
139
var configuration = TrunkBasedConfigurationBuilder . New
139
- . WithIgnoreConfiguration ( new IgnoreConfiguration { Before = commitC . Committer . When } )
140
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Before = before } )
140
141
. Build ( ) ;
141
142
142
143
// ✅ succeeds as expected
@@ -285,8 +286,9 @@ public void GivenGitHubFlowWorkflowWithIgnoreConfigurationBeforeCommitWithTagThe
285
286
fixture . ApplyTag ( "1.0.0" ) ;
286
287
fixture . MakeACommit ( "D" ) ;
287
288
289
+ var before = commitC . Committer . When . AddSeconds ( 1 ) ;
288
290
var configuration = GitHubFlowConfigurationBuilder . New
289
- . WithIgnoreConfiguration ( new IgnoreConfiguration { Before = commitC . Committer . When } )
291
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Before = before } )
290
292
. Build ( ) ;
291
293
292
294
// ✅ succeeds as expected
@@ -331,4 +333,104 @@ public void GivenGitHubFlowWorkflowWithCommitParameterBThenTagShouldBeConsidered
331
333
// ✅ succeeds as expected
332
334
fixture . AssertFullSemver ( semanticVersion , configuration , commitId : commitA . Sha ) ;
333
335
}
336
+
337
+ [ Test ]
338
+ public void GivenTrunkBasedWorkflowWithIgnoreConfigurationForPathThenVersionShouldBeCorrect ( )
339
+ {
340
+ using var fixture = new EmptyRepositoryFixture ( ) ;
341
+
342
+ var commitA = fixture . Repository . MakeACommit ( "A" ) ;
343
+ var commitB = fixture . Repository . MakeACommit ( "B" ) ;
344
+ fixture . MakeACommit ( "C" ) ;
345
+ fixture . MakeACommit ( "D" ) ;
346
+
347
+ var ignoredPath = fixture . Repository . Diff . Compare < LibGit2Sharp . TreeChanges > ( commitA . Tree , commitB . Tree ) . Select ( element => element . Path ) . First ( ) ;
348
+
349
+ var configuration = TrunkBasedConfigurationBuilder . New
350
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Paths = { ignoredPath } } )
351
+ . Build ( ) ;
352
+
353
+ // commitB should be ignored, so version should be as if B didn't exist
354
+ fixture . AssertFullSemver ( "0.0.3" , configuration ) ;
355
+ }
356
+
357
+ [ Test ]
358
+ public void GivenTrunkBasedWorkflowWithIgnoreConfigurationForPathAndCommitParameterCThenVersionShouldBeCorrect ( )
359
+ {
360
+ using var fixture = new EmptyRepositoryFixture ( ) ;
361
+
362
+ var commitA = fixture . Repository . MakeACommit ( "A" ) ;
363
+ fixture . MakeACommit ( "B" ) ;
364
+ var commitC = fixture . Repository . MakeACommit ( "C" ) ;
365
+ fixture . MakeACommit ( "D" ) ;
366
+
367
+ var ignoredPath = fixture . Repository . Diff . Compare < LibGit2Sharp . TreeChanges > ( commitA . Tree , commitC . Tree ) . Select ( element => element . Path ) . First ( ) ;
368
+
369
+ var configuration = TrunkBasedConfigurationBuilder . New
370
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Paths = { ignoredPath } } )
371
+ . Build ( ) ;
372
+
373
+ // commitC should be ignored, so version should be as if C didn't exist
374
+ fixture . AssertFullSemver ( "0.0.2" , configuration , commitId : commitC . Sha ) ;
375
+ }
376
+
377
+ [ Test ]
378
+ public void GivenGitHubFlowWorkflowWithIgnoreConfigurationForPathThenVersionShouldBeCorrect ( )
379
+ {
380
+ using var fixture = new EmptyRepositoryFixture ( ) ;
381
+
382
+ var commitA = fixture . Repository . MakeACommit ( "A" ) ;
383
+ var commitB = fixture . Repository . MakeACommit ( "B" ) ;
384
+ fixture . MakeACommit ( "C" ) ;
385
+ fixture . MakeACommit ( "D" ) ;
386
+
387
+ var ignoredPath = fixture . Repository . Diff . Compare < LibGit2Sharp . TreeChanges > ( commitA . Tree , commitB . Tree ) . Select ( element => element . Path ) . First ( ) ;
388
+
389
+ var configuration = GitHubFlowConfigurationBuilder . New
390
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Paths = { ignoredPath } } )
391
+ . Build ( ) ;
392
+
393
+ // commitB should be ignored, so version should be as if B didn't exist
394
+ fixture . AssertFullSemver ( "0.0.1-3" , configuration ) ;
395
+ }
396
+
397
+ [ Test ]
398
+ public void GivenTrunkBasedWorkflowWithIgnoreConfigurationForTaggedCommitPathThenTagShouldBeIgnored ( )
399
+ {
400
+ using var fixture = new EmptyRepositoryFixture ( ) ;
401
+
402
+ var commitA = fixture . Repository . MakeACommit ( "A" ) ;
403
+ var commitB = fixture . Repository . MakeACommit ( "B" ) ;
404
+ fixture . ApplyTag ( "1.0.0" ) ;
405
+ fixture . MakeACommit ( "C" ) ;
406
+
407
+ var ignoredPath = fixture . Repository . Diff . Compare < LibGit2Sharp . TreeChanges > ( commitA . Tree , commitB . Tree ) . Select ( element => element . Path ) . First ( ) ;
408
+
409
+ var configuration = TrunkBasedConfigurationBuilder . New
410
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Paths = { ignoredPath } } )
411
+ . Build ( ) ;
412
+
413
+ // commitB should be ignored, so version should be as if B didn't exist
414
+ fixture . AssertFullSemver ( "0.0.2" , configuration ) ;
415
+ }
416
+
417
+ [ Test ]
418
+ public void GivenGitHubFlowWorkflowWithIgnoreConfigurationForTaggedCommitPathThenTagShouldBeIgnored ( )
419
+ {
420
+ using var fixture = new EmptyRepositoryFixture ( ) ;
421
+
422
+ var commitA = fixture . Repository . MakeACommit ( "A" ) ;
423
+ var commitB = fixture . Repository . MakeACommit ( "B" ) ;
424
+ fixture . ApplyTag ( "1.0.0" ) ;
425
+ fixture . MakeACommit ( "C" ) ;
426
+
427
+ var ignoredPath = fixture . Repository . Diff . Compare < LibGit2Sharp . TreeChanges > ( commitA . Tree , commitB . Tree ) . Select ( element => element . Path ) . First ( ) ;
428
+
429
+ var configuration = GitHubFlowConfigurationBuilder . New
430
+ . WithIgnoreConfiguration ( new IgnoreConfiguration { Paths = { ignoredPath } } )
431
+ . Build ( ) ;
432
+
433
+ // commitB should be ignored, so version should be as if B didn't exist
434
+ fixture . AssertFullSemver ( "0.0.1-2" , configuration ) ;
435
+ }
334
436
}
0 commit comments