code: func (pm *PatternMatcher) Matches(file string) (bool, error) {
  	matched := false
  	file = filepath.FromSlash(file)
  	parentPath := filepath.Dir(file)
  	parentPathDirs := strings.Split(parentPath, string(os.PathSeparator))
  
  	for _, pattern := range pm.patterns {
  		negative := false
  
  		if pattern.exclusion {
  			negative = true
  		}
  
  		match, err := pattern.match(file)
  		if err != nil {
  			return false, err
  		}
  
  		if !match && parentPath != "." {
  			// Check to see if the pattern matches one of our parent dirs.
  			if len(pattern.dirs) <= len(parentPathDirs) {
  				match, _ = pattern.match(strings.Join(parentPathDirs[:len(pattern.dirs)], string(os.PathSeparator)))
  			}
  		}
  
  		if match {
  			matched = !negative
  		}
  	}
  
  	if matched {
  		logrus.Debugf("Skipping excluded path: %s", file)
  	}
  
  	return matched, nil
  }
docs: // Matches matches path against all the patterns. Matches is not safe to be
  // called concurrently