File tree Expand file tree Collapse file tree 2 files changed +50
-13
lines changed
GitVersionCore.Tests/IntegrationTests
GitVersionCore/VersionCalculation Expand file tree Collapse file tree 2 files changed +50
-13
lines changed Original file line number Diff line number Diff line change 1+ using GitTools . Testing ;
2+ using GitVersion . Configuration ;
3+ using GitVersion . Extensions ;
4+ using GitVersion . Model . Configuration ;
5+ using GitVersionCore . Tests . Helpers ;
6+ using NUnit . Framework ;
7+
8+ namespace GitVersionCore . Tests . IntegrationTests
9+ {
10+ [ TestFixture ]
11+ public class IgnoreBeforeScenarios : TestBase
12+ {
13+ [ Test ]
14+ public void ShouldFallbackToBaseVersionWhenAllCommitsAreIgnored ( )
15+ {
16+ using var fixture = new EmptyRepositoryFixture ( ) ;
17+ var commit = fixture . Repository . MakeACommit ( ) ;
18+
19+ var config = new ConfigurationBuilder ( )
20+ . Add ( new Config
21+ {
22+ Ignore = new IgnoreConfig
23+ {
24+ Before = commit . When ( ) . AddMinutes ( 1 )
25+ }
26+ } ) . Build ( ) ;
27+
28+ fixture . AssertFullSemver ( "0.1.0+0" , config ) ;
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -28,23 +28,29 @@ public BaseVersion GetBaseVersion()
2828 using ( log . IndentLog ( "Calculating base versions" ) )
2929 {
3030 var baseVersions = strategies
31- . SelectMany ( s => s . GetVersions ( ) )
32- . Where ( v =>
31+ . SelectMany ( s =>
3332 {
34- if ( v == null ) return false ;
33+ if ( s is FallbackVersionStrategy )
34+ return s . GetVersions ( ) ;
3535
36- log . Info ( v . ToString ( ) ) ;
37-
38- foreach ( var filter in context . Configuration . VersionFilters )
39- {
40- if ( filter . Exclude ( v , out var reason ) )
36+ return s . GetVersions ( )
37+ . Where ( v =>
4138 {
42- log . Info ( reason ) ;
43- return false ;
44- }
45- }
39+ if ( v == null ) return false ;
40+
41+ log . Info ( v . ToString ( ) ) ;
42+
43+ foreach ( var filter in context . Configuration . VersionFilters )
44+ {
45+ if ( filter . Exclude ( v , out var reason ) )
46+ {
47+ log . Info ( reason ) ;
48+ return false ;
49+ }
50+ }
4651
47- return true ;
52+ return true ;
53+ } ) ;
4854 } )
4955 . Select ( v => new Versions
5056 {
You can’t perform that action at this time.
0 commit comments