goelhardik / ignore

.gitignore based parser implemented in C# according to the .gitignore spec 2.29.2.
MIT License
50 stars 5 forks source link

Bug Ignore.Add("folder") match also folder with prefix #34

Closed mhascak closed 2 years ago

mhascak commented 2 years ago

Hello, I have problem with this case:

Unit test:

[TestCase]
    public void TestIngoreMorePatterns()
    {
        var ignore = new Ignore.Ignore();
        ignore.Add("!.gitignore");
        ignore.Add("folder");

        ignore.IsIgnored(@".gitignore").Should().BeFalse();
        ignore.IsIgnored(@"src/Testfolder/.gitignore").Should().BeFalse();
        ignore.IsIgnored(@"tools/Testfolder/.gitignore").Should().BeFalse();
}

Test is failing but it should not. Testfolder is not folder.

goelhardik commented 2 years ago

Thanks for reporting the issue with the unit test example @mhascak.