diff --git a/watcher.go b/watcher.go index 4ec8efb..800187f 100644 --- a/watcher.go +++ b/watcher.go @@ -30,6 +30,12 @@ func NewWatcher(dir string, g *Generator) (*Watcher, error) { // Watch blocks, watching for changes and triggering rebuilds. // Rapid events (e.g. scp writing an image then its sidecar) are debounced // with a 500 ms window so only one rebuild fires per logical upload. +// +// Rename is watched alongside Create/Write/Remove: moving a photo out of the +// content directory — which is exactly what a /manage delete does when it +// sends files to content/.trash/ — arrives as a Rename (inotify IN_MOVED_FROM) +// on Linux, not a Remove, so without it a delete (or a manual mv) would leave +// the site unrebuilt. func (w *Watcher) Watch() { var timer *time.Timer rebuild := func() { @@ -47,7 +53,8 @@ func (w *Watcher) Watch() { if !isRelevant(event.Name) { continue } - if event.Has(fsnotify.Create) || event.Has(fsnotify.Write) || event.Has(fsnotify.Remove) { + if event.Has(fsnotify.Create) || event.Has(fsnotify.Write) || + event.Has(fsnotify.Remove) || event.Has(fsnotify.Rename) { if timer != nil { timer.Stop() }