31
vendor/github.com/monochromegane/go-gitignore/full_scan_patterns.go
generated
vendored
Normal file
31
vendor/github.com/monochromegane/go-gitignore/full_scan_patterns.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package gitignore
|
||||
|
||||
import "strings"
|
||||
|
||||
// Only benchmark use
|
||||
type fullScanPatterns struct {
|
||||
absolute patterns
|
||||
relative patterns
|
||||
}
|
||||
|
||||
func newFullScanPatterns() *fullScanPatterns {
|
||||
return &fullScanPatterns{
|
||||
absolute: patterns{},
|
||||
relative: patterns{},
|
||||
}
|
||||
}
|
||||
|
||||
func (ps *fullScanPatterns) add(pattern string) {
|
||||
if strings.HasPrefix(pattern, "/") {
|
||||
ps.absolute.add(newPattern(pattern))
|
||||
} else {
|
||||
ps.relative.add(newPattern(pattern))
|
||||
}
|
||||
}
|
||||
|
||||
func (ps fullScanPatterns) match(path string, isDir bool) bool {
|
||||
if ps.absolute.match(path, isDir) {
|
||||
return true
|
||||
}
|
||||
return ps.relative.match(path, isDir)
|
||||
}
|
||||
Reference in New Issue
Block a user