Replace deprecated PatternMatcher.Matches with MatchesResult

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
Jan Rodák 2026-06-12 09:39:58 +02:00
parent b294a92a25
commit 454a1dea45
No known key found for this signature in database
GPG key ID: D458A9B20435C2BF

View file

@ -1185,11 +1185,11 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
// If name is absolute path, then it has to be containerfile outside of build context.
// If not, we should check it for being excluded via pattern matcher.
if !filepath.IsAbs(name) {
excluded, err := pm.Matches(name)
res, err := pm.MatchesResult(name)
if err != nil {
return fmt.Errorf("checking if %q is excluded: %w", name, err)
}
if excluded {
if res.IsMatched() {
// Note: filepath.SkipDir is not possible to use given .dockerignore semantics.
// An exception to exclusions may include an excluded directory, therefore we
// are required to visit all files. :(