Skip to content

Commit

Permalink
Improve directory rename handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Nov 6, 2022
1 parent 4d1fd37 commit a5582f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,17 @@ func (n *Notify) wait() {

logger.Debug("fs.IsDir: %s", fs.IsDir(normalizedName))
if event.Op == fsnotify.Create && shouldWatch(normalizedName, n.candidates) {
err := n.watcher.Remove(normalizedName)
if err != nil {
if !strings.HasPrefix(err.Error(), "can't remove non-existent watch for:") {
logger.Error("watcher.Remove: %s", err)
}
}
logger.Info("gazing at: %s", normalizedName)
n.watcher.Add(normalizedName)
err = n.watcher.Add(normalizedName)
if err != nil {
logger.Error("watcher.Add: %s", err)
}
}

if !ok {
Expand Down

0 comments on commit a5582f2

Please sign in to comment.