Skip to content

Commit

Permalink
Fixup trailing slash issue with scan ignore patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Jul 24, 2024
1 parent 78df3d9 commit b1dd6b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;

namespace ConfigCat.Cli.Services.FileSystem.Ignore;

Expand All @@ -19,5 +20,5 @@ public GlobalIgnorePolicy(DirectoryInfo rootDirectory, params string[] patterns)
public override bool IsIgnoring(FileInfo file) => base.IsIgnoringInternal(file.FullName.Replace(this.rootDirectory.FullName, string.Empty));

public override bool Handles(FileInfo file) =>
file.DirectoryName.IndexOf(this.rootDirectory.FullName) != -1;
file.DirectoryName.AsSlash().Contains(this.rootDirectory.FullName.AsSlash().TrimEnd('/'));
}
2 changes: 1 addition & 1 deletion src/ConfigCat.Cli.Services/FileSystem/Ignore/IgnoreFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task LoadIgnoreFileAsync(CancellationToken token)
public override bool IsIgnoring(FileInfo file) => base.IsIgnoringInternal(file.FullName.Replace(this.File.DirectoryName, string.Empty));

public override bool Handles(FileInfo file) =>
file.DirectoryName.IndexOf(this.File.DirectoryName) != -1;
file.DirectoryName.AsSlash().Contains(this.File.DirectoryName.AsSlash().TrimEnd('/'));

private void ProcessPatterns(string[] patterns)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ConfigCat.Cli.Services/FileSystem/Ignore/IgnorePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace ConfigCat.Cli.Services.FileSystem.Ignore;

internal abstract class IgnorePolicy
{
protected readonly IgnoreRuleSet AcceptMatcher = new IgnoreRuleSet();
protected readonly IgnoreRuleSet IgnoreMatcher = new IgnoreRuleSet();
protected readonly IgnoreRuleSet AcceptMatcher = new();
protected readonly IgnoreRuleSet IgnoreMatcher = new();

public abstract bool IsAccepting(FileInfo file);

Expand Down

0 comments on commit b1dd6b5

Please sign in to comment.