Skip to content

Commit

Permalink
[FIX] fix file modified event
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie authored and Charlie committed Aug 4, 2023
1 parent 9e46d08 commit 45bc0f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/util/watcher/filewatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func (c *combinedEvent) match(events notifyEvents) (notify.EventInfo, bool) {
// combinedEvents describes the event combinations to concatenate,
// this is iterated in order, so the longest matches should be first
var combinedEvents = []combinedEvent{
// MOVE + MODIFY => MODIFY issue: https://github.com/save-abandoned-projects/ignite/issues/8
{[]notify.Event{notify.InMovedFrom, notify.InCloseWrite}, 1},
// DELETE + MODIFY => MODIFY
{[]notify.Event{notify.InDelete, notify.InCloseWrite}, 1},
// MODIFY + DELETE => NONE
Expand Down
7 changes: 7 additions & 0 deletions pkg/util/watcher/filewatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ var testEvents = []notifyEvents{
testEvent(notify.InCloseWrite),
testEvent(notify.InDelete),
},
{
testEvent(notify.InMovedFrom),
testEvent(notify.InCloseWrite),
},
}

var targets = []FileEvents{
Expand All @@ -67,6 +71,9 @@ var targets = []FileEvents{
FileEventModify,
},
{},
{
FileEventModify,
},
}

func extractEvents(updates FileUpdates) (events FileEvents) {
Expand Down

0 comments on commit 45bc0f3

Please sign in to comment.