mirror of
https://github.com/docker/cli.git
synced 2026-01-23 15:21:32 +03:00
vendor: docker v20.10.3-0.20221006185438-87d9d96ab0b6 (v22.06-dev)
full diff: e143eed8bc...87d9d96ab0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -15,12 +15,12 @@ import (
|
||||
|
||||
"github.com/docker/docker/builder/remotecontext/git"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/progress"
|
||||
"github.com/docker/docker/pkg/streamformatter"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/moby/patternmatcher"
|
||||
"github.com/pkg/errors"
|
||||
exec "golang.org/x/sys/execabs"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pm, err := fileutils.NewPatternMatcher(excludes)
|
||||
pm, err := patternmatcher.New(excludes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
|
||||
})
|
||||
}
|
||||
|
||||
func filepathMatches(matcher *fileutils.PatternMatcher, file string) (bool, error) {
|
||||
func filepathMatches(matcher *patternmatcher.PatternMatcher, file string) (bool, error) {
|
||||
file = filepath.Clean(file)
|
||||
if file == "." {
|
||||
// Don't let them exclude everything, kind of silly.
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/moby/patternmatcher"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@@ -316,9 +316,9 @@ func TestDetectArchiveReader(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func mustPatternMatcher(t *testing.T, patterns []string) *fileutils.PatternMatcher {
|
||||
func mustPatternMatcher(t *testing.T, patterns []string) *patternmatcher.PatternMatcher {
|
||||
t.Helper()
|
||||
pm, err := fileutils.NewPatternMatcher(patterns)
|
||||
pm, err := patternmatcher.New(patterns)
|
||||
if err != nil {
|
||||
t.Fatal("failed to construct pattern matcher: ", err)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
|
||||
"github.com/moby/patternmatcher"
|
||||
)
|
||||
|
||||
// ReadDockerignore reads the .dockerignore file in the context directory and
|
||||
@@ -29,13 +29,13 @@ func ReadDockerignore(contextDir string) ([]string, error) {
|
||||
// the list of excluded files. The daemon will remove them from the final context
|
||||
// but they must be in available in the context when passed to the API.
|
||||
func TrimBuildFilesFromExcludes(excludes []string, dockerfile string, dockerfileFromStdin bool) []string {
|
||||
if keep, _ := fileutils.Matches(".dockerignore", excludes); keep {
|
||||
if keep, _ := patternmatcher.Matches(".dockerignore", excludes); keep {
|
||||
excludes = append(excludes, "!.dockerignore")
|
||||
}
|
||||
|
||||
// canonicalize dockerfile name to be platform-independent.
|
||||
dockerfile = filepath.ToSlash(dockerfile)
|
||||
if keep, _ := fileutils.Matches(dockerfile, excludes); keep && !dockerfileFromStdin {
|
||||
if keep, _ := patternmatcher.Matches(dockerfile, excludes); keep && !dockerfileFromStdin {
|
||||
excludes = append(excludes, "!"+dockerfile)
|
||||
}
|
||||
return excludes
|
||||
|
||||
Reference in New Issue
Block a user