Skip to content

Commit

Permalink
watch: Fix regression in watch local fs events (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadmeste authored and harshavardhana committed Apr 18, 2017
1 parent 656f4f1 commit 9a88156
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/client-fs_linux.go
Expand Up @@ -34,7 +34,7 @@ var (
// IsGetEvent checks if the event return is a get event.
func IsGetEvent(event notify.Event) bool {
for _, ev := range EventTypeGet {
if event == ev {
if event&ev != 0 {
return true
}
}
Expand All @@ -44,7 +44,7 @@ func IsGetEvent(event notify.Event) bool {
// IsPutEvent checks if the event returned is a put event
func IsPutEvent(event notify.Event) bool {
for _, ev := range EventTypePut {
if event == ev {
if event&ev != 0 {
return true
}
}
Expand All @@ -54,7 +54,7 @@ func IsPutEvent(event notify.Event) bool {
// IsDeleteEvent checks if the event returned is a delete event
func IsDeleteEvent(event notify.Event) bool {
for _, ev := range EventTypeDelete {
if event == ev {
if event&ev != 0 {
return true
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/client-fs_other.go
Expand Up @@ -37,7 +37,7 @@ func IsGetEvent(event notify.Event) bool {
// IsPutEvent checks if the event returned is a put event
func IsPutEvent(event notify.Event) bool {
for _, ev := range EventTypePut {
if event == ev {
if event&ev != 0 {
return true
}
}
Expand All @@ -46,5 +46,5 @@ func IsPutEvent(event notify.Event) bool {

// IsDeleteEvent checks if the event returned is a delete event
func IsDeleteEvent(event notify.Event) bool {
return event == notify.Remove
return event&notify.Remove != 0
}
6 changes: 3 additions & 3 deletions cmd/client-fs_windows.go
Expand Up @@ -31,13 +31,13 @@ var (

// IsGetEvent checks if the event return is a get event.
func IsGetEvent(event notify.Event) bool {
return event == notify.FileNotifyChangeLastAccess
return event&notify.FileNotifyChangeLastAccess != 0
}

// IsPutEvent checks if the event returned is a put event
func IsPutEvent(event notify.Event) bool {
for _, ev := range EventTypePut {
if event == ev {
if event&ev != 0 {
return true
}
}
Expand All @@ -46,5 +46,5 @@ func IsPutEvent(event notify.Event) bool {

// IsDeleteEvent checks if the event returned is a delete event
func IsDeleteEvent(event notify.Event) bool {
return event == notify.Remove
return event&notify.Remove != 0
}

0 comments on commit 9a88156

Please sign in to comment.