mirror of
https://github.com/docker/compose.git
synced 2025-07-12 16:24:32 +02:00
dockerignore: convert ignore patterns to absolute paths [ch9237] (#3743)
In most places in Tilt, we try to use absolute paths everywhere. So this makes things more consistent with the rest of Tilt, and lets us be a bit more flexible in how we handle subdirs and parent dirs in ignores. Fixes https://github.com/tilt-dev/tilt/issues/3740
This commit is contained in:
parent
8b39322365
commit
c7ba7d9de5
@ -421,9 +421,6 @@ func TestWatchNonexistentDirectory(t *testing.T) {
|
|||||||
f := newNotifyFixture(t)
|
f := newNotifyFixture(t)
|
||||||
defer f.tearDown()
|
defer f.tearDown()
|
||||||
|
|
||||||
ignore, _ := dockerignore.NewDockerPatternMatcher(f.paths[0], []string{"./"})
|
|
||||||
f.setIgnore(ignore)
|
|
||||||
|
|
||||||
root := f.JoinPath("root")
|
root := f.JoinPath("root")
|
||||||
err := os.Mkdir(root, 0777)
|
err := os.Mkdir(root, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -441,12 +438,9 @@ func TestWatchNonexistentDirectory(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "darwin" {
|
|
||||||
// for directories that were the root of an Add, we don't report creation, cf. watcher_darwin.go
|
// for directories that were the root of an Add, we don't report creation, cf. watcher_darwin.go
|
||||||
f.assertEvents()
|
f.assertEvents()
|
||||||
} else {
|
|
||||||
f.assertEvents(parent)
|
|
||||||
}
|
|
||||||
f.events = nil
|
f.events = nil
|
||||||
f.WriteFile(file, "hello")
|
f.WriteFile(file, "hello")
|
||||||
|
|
||||||
@ -457,9 +451,6 @@ func TestWatchNonexistentFileInNonexistentDirectory(t *testing.T) {
|
|||||||
f := newNotifyFixture(t)
|
f := newNotifyFixture(t)
|
||||||
defer f.tearDown()
|
defer f.tearDown()
|
||||||
|
|
||||||
ignore, _ := dockerignore.NewDockerPatternMatcher(f.paths[0], []string{"./"})
|
|
||||||
f.setIgnore(ignore)
|
|
||||||
|
|
||||||
root := f.JoinPath("root")
|
root := f.JoinPath("root")
|
||||||
err := os.Mkdir(root, 0777)
|
err := os.Mkdir(root, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -214,6 +214,12 @@ func (d *naiveNotify) shouldNotify(path string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := d.notifyList[path]; ok {
|
if _, ok := d.notifyList[path]; ok {
|
||||||
|
// We generally don't care when directories change at the root of an ADD
|
||||||
|
stat, err := os.Lstat(path)
|
||||||
|
isDir := err == nil && stat.IsDir()
|
||||||
|
if isDir {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// TODO(dmiller): maybe use a prefix tree here?
|
// TODO(dmiller): maybe use a prefix tree here?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user