Skip to content

Commit 789226f

Browse files
author
roeil
committed
feat: introduce paths-filter based on commit filtering
1 parent f37d7df commit 789226f

34 files changed

+183
-34
lines changed

docs/input/docs/workflows/GitFlow/v1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ branches:
148148
is-main-branch: false
149149
ignore:
150150
sha: []
151+
paths: []
151152
mode: ContinuousDelivery
152153
label: '{BranchName}'
153154
increment: Inherit

docs/input/docs/workflows/GitHubFlow/v1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ branches:
9797
is-main-branch: false
9898
ignore:
9999
sha: []
100+
paths: []
100101
mode: ContinuousDelivery
101102
label: '{BranchName}'
102103
increment: Inherit

docs/input/docs/workflows/TrunkBased/preview1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ branches:
8282
pre-release-weight: 30000
8383
ignore:
8484
sha: []
85+
paths: []
8586
mode: ContinuousDelivery
8687
label: '{BranchName}'
8788
increment: Inherit

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ branches:
148148
is-main-branch: false
149149
ignore:
150150
sha: []
151+
paths: []
151152
mode: ContinuousDelivery
152153
label: '{BranchName}'
153154
increment: Inherit

src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ branches:
148148
is-main-branch: false
149149
ignore:
150150
sha: []
151+
paths: []
151152
mode: ContinuousDelivery
152153
label: '{BranchName}'
153154
increment: Inherit

src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ branches:
9797
is-main-branch: false
9898
ignore:
9999
sha: []
100+
paths: []
100101
mode: ContinuousDelivery
101102
label: '{BranchName}'
102103
increment: Inherit

src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ branches:
8282
pre-release-weight: 30000
8383
ignore:
8484
sha: []
85+
paths: []
8586
mode: ContinuousDelivery
8687
label: '{BranchName}'
8788
increment: Inherit

src/GitVersion.Configuration/IgnoreConfiguration.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.ObjectModel;
12
using GitVersion.Configuration.Attributes;
23

34
namespace GitVersion.Configuration;
@@ -24,5 +25,11 @@ public string? BeforeString
2425
public HashSet<string> Shas { get; init; } = [];
2526

2627
[JsonIgnore]
27-
public bool IsEmpty => Before == null && Shas.Count == 0;
28+
public bool IsEmpty => Before == null && Shas.Count == 0 && Paths.Count == 0;
29+
30+
IReadOnlyCollection<string> IIgnoreConfiguration.Paths => Paths;
31+
32+
[JsonPropertyName("paths")]
33+
[JsonPropertyDescription("A sequence of file paths to be excluded from the version calculations.")]
34+
public Collection<string> Paths { get; init; } = [];
2835
}

src/GitVersion.Core.Tests/VersionCalculation/MinDateVersionFilterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void VerifyNullGuard()
1212
var dummy = DateTimeOffset.UtcNow.AddSeconds(1.0);
1313
var sut = new MinDateVersionFilter(dummy);
1414

15-
Should.Throw<ArgumentNullException>(() => sut.Exclude(null!, out _));
15+
Should.Throw<ArgumentNullException>(() => sut.Exclude((IBaseVersion)null!, out _));
1616
}
1717

1818
[Test]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using GitVersion.Core.Tests.Helpers;
2+
using GitVersion.VersionCalculation;
3+
4+
namespace GitVersion.Core.Tests;
5+
6+
[TestFixture]
7+
public class PathFilterTests : TestBase
8+
{
9+
[Test]
10+
public void VerifyNullGuard() => Should.Throw<ArgumentNullException>(() => new PathFilter(null!));
11+
}

0 commit comments

Comments
 (0)