fix(ignore): ensure normalization of patterns and paths match (fixes #9597) (#9717)

In ignores, normalize the input when parsing it.
When scanning, normalize earlier such that the path is already
normalized when checking ignores. This requires splitting normalization
of the string from normalization of the file, as we don't want to
attempt the latter if the file is ignored.

Closes #9598

---------

Co-authored-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Simon Frei
2024-09-28 17:16:44 +02:00
committed by GitHub
co-authored by Jakob Borg
parent 3c476542d2
commit 605fd6d726
3 changed files with 59 additions and 35 deletions
+4 -1
View File
@@ -805,7 +805,10 @@ func TestIssue3174(t *testing.T) {
t.Fatal(err)
}
if !pats.Match("åäö").IsIgnored() {
// The pattern above is normalized when parsing, and in order for this
// string to match the pattern, it needs to use the same normalization. And
// Go always uses NFC regardless of OS, while we use NFD on macos.
if !pats.Match(nativeUnicodeNorm("åäö")).IsIgnored() {
t.Error("Should match")
}
}