MCPcopy Create free account
hub / github.com/go-git/go-git / Match

Method Match

plumbing/format/gitignore/pattern.go:68–90  ·  view source on GitHub ↗
(path []string, isDir bool)

Source from the content-addressed store, hash-verified

66}
67
68func (p *pattern) Match(path []string, isDir bool) MatchResult {
69 if len(path) <= len(p.domain) {
70 return NoMatch
71 }
72 for i, e := range p.domain {
73 if path[i] != e {
74 return NoMatch
75 }
76 }
77
78 path = path[len(p.domain):]
79 if p.isGlob && !p.globMatch(path, isDir) {
80 return NoMatch
81 } else if !p.isGlob && !p.simpleNameMatch(path, isDir) {
82 return NoMatch
83 }
84
85 if p.inclusion {
86 return Include
87 } else {
88 return Exclude
89 }
90}
91
92func (p *pattern) simpleNameMatch(path []string, isDir bool) bool {
93 for i, name := range path {

Callers

nothing calls this directly

Calls 2

globMatchMethod · 0.95
simpleNameMatchMethod · 0.95

Tested by

no test coverage detected