File tree 2 files changed +50
-13
lines changed
GitVersionCore/VersionCalculation
GitVersionCore.Tests/IntegrationTests
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()
28
28
using ( log . IndentLog ( "Calculating base versions" ) )
29
29
{
30
30
var baseVersions = strategies
31
- . SelectMany ( s => s . GetVersions ( ) )
32
- . Where ( v =>
31
+ . SelectMany ( s =>
33
32
{
34
- if ( v == null ) return false ;
33
+ if ( s is FallbackVersionStrategy )
34
+ return s . GetVersions ( ) ;
35
35
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 =>
41
38
{
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
+ }
46
51
47
- return true ;
52
+ return true ;
53
+ } ) ;
48
54
} )
49
55
. Select ( v => new Versions
50
56
{
You can’t perform that action at this time.
0 commit comments