Skip to content

Commit

Permalink
handle wildcard globs correctly. Fixes #3740 (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks committed Sep 11, 2020
1 parent 94dedac commit 3fc0a02
Show file tree
Hide file tree
Showing 33 changed files with 542 additions and 224 deletions.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -72,6 +72,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.6.1
github.com/theupdateframework/notary v0.6.1 // indirect
github.com/tilt-dev/dockerignore v0.0.0-20200910202654-0d8c17a73277
github.com/tilt-dev/fsevents v0.0.0-20200515134857-2efe37af20de
github.com/tilt-dev/fsnotify v1.4.8-0.20200727200623-991e307aab7f
github.com/tilt-dev/localregistry-go v0.0.0-20200615231835-07e386f4ebd7
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Expand Up @@ -463,6 +463,8 @@ github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
Expand Down Expand Up @@ -641,6 +643,8 @@ github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand Down Expand Up @@ -680,6 +684,8 @@ github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz
github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY=
github.com/tilt-dev/client-go v0.0.0-20200326150806-41017343d309 h1:gqiy2KYVUPRB63sK5cEaxYM7KWQD/G3Y7fRQCKsZJtg=
github.com/tilt-dev/client-go v0.0.0-20200326150806-41017343d309/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8=
github.com/tilt-dev/dockerignore v0.0.0-20200910202654-0d8c17a73277 h1:+M1rb07n9/WS/UdOFTIy+fXyAhcqZkkLU5UcNcq7zO4=
github.com/tilt-dev/dockerignore v0.0.0-20200910202654-0d8c17a73277/go.mod h1:jVw8aojw83Ph6G4lQn0Xe5az++nNnFrK1dNQwZzT3Mc=
github.com/tilt-dev/fsevents v0.0.0-20200515134857-2efe37af20de h1:tG+nJMUUxV7MJm/MeU1Mw7rvmwN9GWyHMMg+wtf9HS4=
github.com/tilt-dev/fsevents v0.0.0-20200515134857-2efe37af20de/go.mod h1:1jUbPVh7Ani2CSublmvP7+zqTgR06A8Y0MKU9Xr2L5s=
github.com/tilt-dev/fsnotify v1.4.8-0.20200727200623-991e307aab7f h1:A3/0Ild2AvlDohwdHnyHYxcrm4syPBT3olxgQrXLbXw=
Expand Down Expand Up @@ -906,6 +912,7 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand Down Expand Up @@ -1043,6 +1050,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
6 changes: 3 additions & 3 deletions internal/dockerignore/ignore.go
Expand Up @@ -7,14 +7,14 @@ import (
"strings"

"github.com/docker/docker/builder/dockerignore"
"github.com/docker/docker/pkg/fileutils"
tiltDockerignore "github.com/tilt-dev/dockerignore"

"github.com/tilt-dev/tilt/internal/ospath"
)

type dockerPathMatcher struct {
repoRoot string
matcher *fileutils.PatternMatcher
matcher *tiltDockerignore.PatternMatcher
}

func (i dockerPathMatcher) Matches(f string) (bool, error) {
Expand Down Expand Up @@ -96,7 +96,7 @@ func NewDockerPatternMatcher(repoRoot string, patterns []string) (*dockerPathMat
return nil, err
}

pm, err := fileutils.NewPatternMatcher(absPatterns(absRoot, patterns))
pm, err := tiltDockerignore.NewPatternMatcher(absPatterns(absRoot, patterns))
if err != nil {
return nil, err
}
Expand Down
12 changes: 12 additions & 0 deletions internal/dockerignore/ignore_test.go
Expand Up @@ -15,6 +15,7 @@ func TestMatches(t *testing.T) {
tf := newTestFixture(t, "node_modules")
defer tf.TearDown()
tf.AssertResult(tf.JoinPath("node_modules", "foo"), true)
tf.AssertResult(tf.JoinPath("node_modules", "foo", "bar", "baz"), true)
tf.AssertResultEntireDir(tf.JoinPath("node_modules"), true)
tf.AssertResult(tf.JoinPath("foo", "bar"), false)
tf.AssertResultEntireDir(tf.JoinPath("foo"), false)
Expand Down Expand Up @@ -68,6 +69,17 @@ func TestUplevelDoubleGlob(t *testing.T) {
tf.AssertResult(tf.JoinPath("a", "b.txt"), true)
}

func TestUplevelMatchDirDoubleGlob(t *testing.T) {
tf := newTestFixture(t, "../**/b")
defer tf.TearDown()
tf.AssertResult(tf.JoinPath("a", "temporary.txt"), false)
tf.AssertResult(tf.JoinPath("a", "b"), true)
tf.AssertResult(tf.JoinPath("a", "b", "temporary.txt"), true)
tf.AssertResult(tf.JoinPath("a", "b", "c", "temporary.txt"), true)
tf.AssertResult(tf.JoinPath("a", "b", "c", "d", "temporary.txt"), true)
tf.AssertResult(tf.JoinPath("a", "b2", "c", "d", "temporary.txt"), false)
}

func TestOneCharacterExtension(t *testing.T) {
tf := newTestFixture(t, "temp?")
defer tf.TearDown()
Expand Down
27 changes: 0 additions & 27 deletions vendor/github.com/docker/docker/pkg/fileutils/fileutils_darwin.go

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/github.com/docker/docker/pkg/fileutils/fileutils_unix.go

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions vendor/github.com/sirupsen/logrus/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions vendor/github.com/sirupsen/logrus/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions vendor/github.com/sirupsen/logrus/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fc0a02

Please sign in to comment.