Skip to content

Commit 0a43d15

Browse files
committed
refactor(config): Use HashSet for ignore paths to ensure uniqueness and improve performance
1 parent 5d5aaa1 commit 0a43d15

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/GitVersion.Configuration/IgnoreConfiguration.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.ObjectModel;
1+
using System.Globalization;
22
using GitVersion.Configuration.Attributes;
33

44
namespace GitVersion.Configuration;
@@ -14,7 +14,7 @@ internal record IgnoreConfiguration : IIgnoreConfiguration
1414
public string? BeforeString
1515
{
1616
get => Before?.ToString("yyyy-MM-ddTHH:mm:ssZ");
17-
init => Before = value is null ? null : DateTimeOffset.Parse(value);
17+
init => Before = value is null ? null : DateTimeOffset.Parse(value, CultureInfo.InvariantCulture);
1818
}
1919

2020
[JsonIgnore]
@@ -24,11 +24,11 @@ public string? BeforeString
2424
[JsonPropertyDescription("A sequence of SHAs to be excluded from the version calculations.")]
2525
public HashSet<string> Shas { get; init; } = [];
2626

27-
IReadOnlyCollection<string> IIgnoreConfiguration.Paths => Paths;
27+
IReadOnlySet<string> IIgnoreConfiguration.Paths => Paths;
2828

2929
[JsonPropertyName("paths")]
3030
[JsonPropertyDescription("A sequence of file paths to be excluded from the version calculations.")]
31-
public Collection<string> Paths { get; init; } = [];
31+
public HashSet<string> Paths { get; init; } = [];
3232

3333
[JsonIgnore]
3434
public bool IsEmpty => Before == null && Shas.Count == 0 && Paths.Count == 0;

src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public interface IIgnoreConfiguration
66

77
IReadOnlySet<string> Shas { get; }
88

9-
IReadOnlyCollection<string> Paths { get; }
9+
IReadOnlySet<string> Paths { get; }
1010

1111
bool IsEmpty { get; }
1212
}

src/GitVersion.Core/PublicAPI.Shipped.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ GitVersion.Configuration.IGitVersionConfiguration.Workflow.get -> string?
144144
GitVersion.Configuration.IIgnoreConfiguration
145145
GitVersion.Configuration.IIgnoreConfiguration.Before.get -> System.DateTimeOffset?
146146
GitVersion.Configuration.IIgnoreConfiguration.IsEmpty.get -> bool
147-
GitVersion.Configuration.IIgnoreConfiguration.Paths.get -> System.Collections.Generic.IReadOnlyCollection<string!>!
148147
GitVersion.Configuration.IIgnoreConfiguration.Shas.get -> System.Collections.Generic.IReadOnlySet<string!>!
149148
GitVersion.Configuration.IPreventIncrementConfiguration
150149
GitVersion.Configuration.IPreventIncrementConfiguration.OfMergedBranch.get -> bool?
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#nullable enable
2+
GitVersion.Configuration.IIgnoreConfiguration.Paths.get -> System.Collections.Generic.IReadOnlySet<string!>!

0 commit comments

Comments
 (0)