From e4c2f78abe427d9fdbfb46bb205f2210a03704fa Mon Sep 17 00:00:00 2001 From: Bernhard Guillon Date: Mon, 6 Jul 2026 22:30:55 +0200 Subject: Watch nested dirs: recursively add watchers for subdirs on create When mkdir -p creates multiple nested dirs at once, only the first level got a watcher. Now syncCreate walks all subdirectories and adds watchers for them. The event handler already filters ignored paths. --- watcher.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/watcher.go b/watcher.go index 68a1a1b..14cc584 100644 --- a/watcher.go +++ b/watcher.go @@ -113,6 +113,13 @@ func syncCreate(srcPath, destPath, relPath string, manifest *Manifest, stack *Gi if err := watcher.Add(srcPath); err != nil { logErrorf("watch %s: %v", relPath, err) } + filepath.Walk(srcPath, func(path string, info os.FileInfo, err error) error { + if err != nil || !info.IsDir() || path == srcPath { + return nil + } + watcher.Add(path) + return nil + }) if dryRun { logInfo("[dry-run] would create dir: %s", relPath) return -- cgit v1.2.3