Skip to content

Commit 0a75e80

Browse files
technoweenieprogrium
authored andcommitted
skip ignored files before callbacks
1 parent 88c0f93 commit 0a75e80

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

watcher.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,6 @@ func (w *Watcher) listRecursive(name string) (map[string]os.FileInfo, error) {
311311
return err
312312
}
313313

314-
for _, f := range w.ffh {
315-
err := f(info, path)
316-
if err == ErrSkip {
317-
return nil
318-
}
319-
if err != nil {
320-
return err
321-
}
322-
}
323-
324314
// If path is ignored and it's a directory, skip the directory. If it's
325315
// ignored and it's a single file, skip the file.
326316
_, ignored := w.ignored[path]
@@ -336,6 +326,17 @@ func (w *Watcher) listRecursive(name string) (map[string]os.FileInfo, error) {
336326
}
337327
return nil
338328
}
329+
330+
for _, f := range w.ffh {
331+
err := f(info, path)
332+
if err == ErrSkip {
333+
return nil
334+
}
335+
if err != nil {
336+
return err
337+
}
338+
}
339+
339340
// Add the path and it's info to the file list.
340341
fileList[path] = info
341342
return nil

0 commit comments

Comments
 (0)