@@ -22,8 +22,8 @@ type darwinNotify struct {
22
22
sm * sync.Mutex
23
23
24
24
// When a watch is created for a directory, we've seen fsevents non-determistically
25
- // fire 0-2 CREATE events for that directory. We want to ignore these.
26
- ignoreCreatedEvents map [string ]int
25
+ // fire 0-3 CREATE events for that directory. We want to ignore these.
26
+ ignoreCreatedEvents map [string ]bool
27
27
}
28
28
29
29
func (d * darwinNotify ) loop () {
@@ -41,11 +41,8 @@ func (d *darwinNotify) loop() {
41
41
42
42
if e .Flags & fsevents .ItemCreated == fsevents .ItemCreated {
43
43
d .sm .Lock ()
44
- ignoreCount := d .ignoreCreatedEvents [e .Path ]
45
- shouldIgnore := ignoreCount > 0
46
- if shouldIgnore {
47
- d .ignoreCreatedEvents [e .Path ]--
48
- } else {
44
+ shouldIgnore := d .ignoreCreatedEvents [e .Path ]
45
+ if ! shouldIgnore {
49
46
// If we got a created event for something
50
47
// that's not on the ignore list, we assume
51
48
// we're done with the spurious events.
@@ -84,9 +81,9 @@ func (d *darwinNotify) Add(name string) error {
84
81
es .Paths = append (es .Paths , name )
85
82
86
83
if d .ignoreCreatedEvents == nil {
87
- d .ignoreCreatedEvents = make (map [string ]int , 1 )
84
+ d .ignoreCreatedEvents = make (map [string ]bool , 1 )
88
85
}
89
- d .ignoreCreatedEvents [name ] = 2
86
+ d .ignoreCreatedEvents [name ] = true
90
87
91
88
if len (es .Paths ) == 1 {
92
89
es .Start ()
0 commit comments