diff --git a/default-rsync.lua b/default-rsync.lua index 98eea27..301b477 100644 --- a/default-rsync.lua +++ b/default-rsync.lua @@ -45,9 +45,7 @@ default.rsync = { local paths = elist.getPaths( function(etype, path1, path2) - if string.byte(path1, -1) == 47 and - (etype == 'Delete' or etype == 'Create') - then + if string.byte(path1, -1) == 47 and etype == 'Delete' then return sub(path1)..'***', sub(path2) else return sub(path1), sub(path2) diff --git a/lsyncd.lua b/lsyncd.lua index 3a9391c..8e31d61 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -1135,8 +1135,7 @@ local Sync = (function() end ----- - -- Returns true if this Sync concerns about - -- 'path' + -- Returns true if this Sync concerns about 'path' -- local function concerns(self, path) -- not concerned if watch rootdir doesnt match @@ -1274,6 +1273,18 @@ local Sync = (function() end end + if etype == 'Create' and path:byte(-1) == 47 then + local entries = lsyncd.readdir(self.source .. path) + if entries then + for dirname, isdir in pairs(entries) do + local pd = path .. dirname + if isdir then pd = pd..'/' end + log('Delay', 'Create creates Create on ',pd) + delay(self, 'Create', time, pd, nil) + end + end + end + if etype == 'Move' and not self.config.onMove then -- if there is no move action defined, -- split a move as delete/create @@ -1853,18 +1864,18 @@ local Inotify = (function() end local entries = lsyncd.readdir(path) - if not entries then - return - end + if not entries then return end + for dirname, isdir in pairs(entries) do local pd = path .. dirname if isdir then pd = pd..'/' end -- creates a Create event for entry. - if raiseSync then - local relative = splitPath(pd, syncRoots[raiseSync]) - if relative then raiseSync:delay('Create', raiseTime, relative) end - end +-- No longer needed? (TODO) +-- if raiseSync then +-- local relative = splitPath(pd, syncRoots[raiseSync]) +-- if relative then raiseSync:delay('Create', raiseTime, relative) end +-- end -- adds syncs for subdirs if isdir then addWatch(pd, true, raiseSync, raiseTime) end end diff --git a/tests/churn-rsync.lua b/tests/churn-rsync.lua index 7279007..bf3ab17 100755 --- a/tests/churn-rsync.lua +++ b/tests/churn-rsync.lua @@ -14,7 +14,7 @@ local tdir, srcdir, trgdir = mktemps() churn(srcdir, 10) local logs = {} -logs = {"-log", "Delay", "-log", "Fsevents" } +-- logs = {"-log", "Delay", "-log", "Fsevents" } local pid = spawn("./lsyncd", "-nodaemon", "-delay", "5", "-rsync", srcdir, trgdir, unpack(logs))