dazinator / DotNet.Glob

A fast globbing library for .NET / .NETStandard applications. Outperforms Regex.
MIT License
363 stars 27 forks source link

Unexpected match with ** #33

Closed fwinkelbauer closed 7 years ago

fwinkelbauer commented 7 years ago

Hi,

I just found an unexpected match when fiddling around with your library. I am not sure if this is a bug, or if my understanding is lacking:

var glob = DotNet.Globbing.Glob.Parse("Bumpy/**/AssemblyInfo.cs");

// success - expected
Assert.IsTrue(glob.IsMatch("Bumpy/Properties/AssemblyInfo.cs"));

// failure - unexpected
Assert.IsFalse(glob.IsMatch("Bumpy.Test/Properties/AssemblyInfo.cs"));
dazinator commented 7 years ago

Sorry yes this is a bug as it shouldnt match.

Bumpy*/**/AssemblyInfo.cs should be required to match that second case.

I'll add a test case and investigate, thanks for raising.

dazinator commented 7 years ago

I have found a quirk. If you set some global options (should not be necessary though) then this behaves as expected:

 GlobParseOptions.Default.AllowInvalidPathCharacters = true;

This option to allow you to use invalid path characters in a glob pattern is something I added very recently so I expect it has introduced this bug! If you need a temporary work around, you can resort to the above, either way I'll get a fix out sometime soon.

fwinkelbauer commented 7 years ago

Take your time! Thank you!

dazinator commented 7 years ago

Fixed as of version 1.6.5 - thank you for reporting this.