| 44 | } |
| 45 | |
| 46 | func (i dockerPathMatcher) MatchesEntireDir(f string) (bool, error) { |
| 47 | matches, err := i.Matches(f) |
| 48 | if !matches || err != nil { |
| 49 | return matches, err |
| 50 | } |
| 51 | |
| 52 | // We match the dir, but we might exclude files underneath it. |
| 53 | if i.matcher.Exclusions() { |
| 54 | for _, pattern := range i.matcher.Patterns() { |
| 55 | if !pattern.Exclusion() { |
| 56 | continue |
| 57 | } |
| 58 | if paths.IsChild(f, pattern.String()) { |
| 59 | // Found an exclusion match -- we don't match this whole dir |
| 60 | return false, nil |
| 61 | } |
| 62 | } |
| 63 | return true, nil |
| 64 | } |
| 65 | return true, nil |
| 66 | } |
| 67 | |
| 68 | func LoadDockerIgnore(build *types.BuildConfig) (PathMatcher, error) { |
| 69 | if build == nil { |