MCPcopy
hub / github.com/docker/compose / shouldSkipDir

Method shouldSkipDir

pkg/watch/watcher_naive.go:237–261  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

235}
236
237func (d *naiveNotify) shouldSkipDir(path string) bool {
238 // If path is directly in the notifyList, we should always watch it.
239 if d.notifyList[path] {
240 return false
241 }
242
243 // Suppose we're watching
244 // /src/.tiltignore
245 // but the .tiltignore file doesn't exist.
246 //
247 // Our watcher will create an inotify watch on /src/.
248 //
249 // But then we want to make sure we don't recurse from /src/ down to /src/node_modules.
250 //
251 // To handle this case, we only want to traverse dirs that are:
252 // - A child of a directory that's in our notify list, or
253 // - A parent of a directory that's in our notify list
254 // (i.e., to cover the "path doesn't exist" case).
255 for root := range d.notifyList {
256 if pathutil.IsChild(root, path) || pathutil.IsChild(path, root) {
257 return false
258 }
259 }
260 return true
261}
262
263func (d *naiveNotify) add(path string) error {
264 err := d.watcher.Add(path)

Callers 2

watchRecursivelyMethod · 0.95
loopMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected