File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package codeowners
22
33import (
44 "fmt"
5- "os "
5+ "path/filepath "
66 "regexp"
77 "strings"
88)
@@ -32,6 +32,9 @@ func newPattern(patternStr string) (pattern, error) {
3232
3333// match tests if the path provided matches the pattern
3434func (p pattern ) match (testPath string ) (bool , error ) {
35+ // Normalize Windows-style path separators to forward slashes
36+ testPath = filepath .ToSlash (testPath )
37+
3538 if p .leftAnchoredLiteral {
3639 prefix := p .pattern
3740
@@ -51,7 +54,7 @@ func (p pattern) match(testPath string) (bool, error) {
5154 }
5255
5356 // Otherwise check if the test path is a subdirectory of the pattern
54- if len (testPath ) > len (prefix ) && testPath [len (prefix )] == os . PathSeparator {
57+ if len (testPath ) > len (prefix ) && testPath [len (prefix )] == '/' {
5558 return testPath [:len (prefix )] == prefix , nil
5659 }
5760
You can’t perform that action at this time.
0 commit comments