aboutsummaryrefslogtreecommitdiffstats
path: root/watcher.go
diff options
context:
space:
mode:
authorBernhard Guillon <Bernhard.Guillon@begu.org>2026-07-06 22:30:55 +0200
committerBernhard Guillon <Bernhard.Guillon@begu.org>2026-07-06 22:30:55 +0200
commite4c2f78abe427d9fdbfb46bb205f2210a03704fa (patch)
treed7b355bd2aa5e76d828d9ffdbbcaf2b0ac088fac /watcher.go
parent40b39e093ce6af33e82801c1edd7f64faa5ceee7 (diff)
downloadsourcewatch-main.tar.gz
sourcewatch-main.zip
Watch nested dirs: recursively add watchers for subdirs on createHEADmain
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.
Diffstat (limited to 'watcher.go')
-rw-r--r--watcher.go7
1 files changed, 7 insertions, 0 deletions
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