mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-06 00:30:46 +00:00
working on excludes
This commit is contained in:
parent
f5fc8c3bd2
commit
6c1a3edeb0
13
lsyncd.lua
13
lsyncd.lua
@ -3062,16 +3062,15 @@ local default_rsync = {
|
|||||||
|
|
||||||
local paths = elist.getPaths(
|
local paths = elist.getPaths(
|
||||||
function(etype, path1, path2)
|
function(etype, path1, path2)
|
||||||
if (etype == "Delete" or etype == "Create")
|
if etype == "Delete" and string.byte(path1, -1) == 47 then
|
||||||
and string.byte(path1, -1) == 47
|
|
||||||
then
|
|
||||||
return sub(path1) .. "***", sub(path2)
|
return sub(path1) .. "***", sub(path2)
|
||||||
else
|
else
|
||||||
return sub(path1), sub(path2)
|
return sub(path1), sub(path2)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- stores all filters with integer index
|
-- stores all filters with integer index
|
||||||
local filterI = inlet.getExcludes();
|
--local filterI = inlet.getExcludes();
|
||||||
|
local filterI = {}
|
||||||
-- stores all filters with path index
|
-- stores all filters with path index
|
||||||
local filterP = {}
|
local filterP = {}
|
||||||
|
|
||||||
@ -3084,7 +3083,7 @@ local default_rsync = {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
filterP[path]=true
|
filterP[path]=true
|
||||||
table.insert(filterI, "+ "..path)
|
table.insert(filterI, path)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adds a path to the filter, for rsync this needs
|
-- adds a path to the filter, for rsync this needs
|
||||||
@ -3101,7 +3100,6 @@ local default_rsync = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(filterI, "- *")
|
|
||||||
|
|
||||||
local filterS = table.concat(filterI, "\n")
|
local filterS = table.concat(filterI, "\n")
|
||||||
local filter0 = table.concat(filterI, "\000")
|
local filter0 = table.concat(filterI, "\000")
|
||||||
@ -3116,7 +3114,8 @@ local default_rsync = {
|
|||||||
"--delete",
|
"--delete",
|
||||||
"--force",
|
"--force",
|
||||||
"--from0",
|
"--from0",
|
||||||
"--exclude-from=-",
|
"--include-from=-",
|
||||||
|
"--exclude=*",
|
||||||
config.source,
|
config.source,
|
||||||
config.target)
|
config.target)
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user