From d1ef5f3d5115af50c9f8dd15604bf46e300238d4 Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Thu, 5 Jan 2017 10:22:00 +0100 Subject: [PATCH] use missing-args for rsyncssh too --- default-rsync.lua | 21 ------------ default-rsyncssh.lua | 80 +++----------------------------------------- 2 files changed, 5 insertions(+), 96 deletions(-) diff --git a/default-rsync.lua b/default-rsync.lua index db781a4..81fb129 100644 --- a/default-rsync.lua +++ b/default-rsync.lua @@ -139,27 +139,6 @@ local replaceRsyncFilter = end --- --- Mutates paths for rsync filter rules, --- changes deletes to multi path patterns --- --- local pathMutator = --- function ---( --- etype, --- path1, --- path2 ---) --- if string.byte( path1, -1 ) == 47 --- and etype == 'Delete' --- then --- return replaceRsyncFilter( path1 ) .. '***', replaceRsyncFilter( path2 ) --- else --- return replaceRsyncFilter( path1 ), replaceRsyncFilter( path2 ) --- end ---end - - -- -- Spawns rsync for a list of events -- diff --git a/default-rsyncssh.lua b/default-rsyncssh.lua index 801ee0a..73751af 100644 --- a/default-rsyncssh.lua +++ b/default-rsyncssh.lua @@ -105,28 +105,6 @@ local replaceRsyncFilter = end --- --- Mutates paths for rsync filter rules, --- changes deletes to multi path patterns --- -local pathMutator = - function -( - etype, - path1, - path2 -) - if string.byte( path1, -1 ) == 47 - and etype == 'Delete' - then - return replaceRsyncFilter( path1 ) .. '***', replaceRsyncFilter( path2 ) - else - return replaceRsyncFilter( path1 ), replaceRsyncFilter( path2 ) - end -end - - - -- -- Spawns rsync for a list of events -- @@ -177,59 +155,12 @@ rsyncssh.action = function -- gets the list of paths for the event list -- deletes create multi match patterns - local paths = elist.getPaths( pathMutator ) - - -- stores all filters by integer index - local filterI = { } - - -- stores all filters with path index - local filterP = { } - - -- adds one path to the filter - local function addToFilter - ( - path - ) - if filterP[ path ] - then - return - end - - filterP[ path ] = true - - table.insert( filterI, path ) - end - - -- adds a path to the filter. - -- - -- rsync needs to have entries for all steps in the path, - -- so the file for example d1/d2/d3/f1 needs following filters: - -- 'd1/', 'd1/d2/', 'd1/d2/d3/' and 'd1/d2/d3/f1' - for _, path in ipairs( paths ) - do - if path and path ~= '' - then - addToFilter( path ) - - local pp = string.match( path, '^(.*/)[^/]+/?' ) - - while pp - do - addToFilter( pp ) - - pp = string.match( pp, '^(.*/)[^/]+/?' ) - end - end - end - - local filterS = table.concat( filterI, '\n' ) - - local filter0 = table.concat( filterI, '\000' ) + local paths = elist.getPaths( ) log( 'Normal', 'Rsyncing list\n', - filterS + table.concat( paths, '\n' ) ) local delete = nil @@ -237,20 +168,19 @@ rsyncssh.action = function if config.delete == true or config.delete == 'running' then - delete = { '--delete', '--ignore-errors' } + delete = { '--delete-missing-args', '--ignore-errors' } end spawn( elist, config.rsync.binary, - '<', filter0, + '<', table.concat( filterI, '\000' ), config.rsync._computed, '-r', delete, '--force', '--from0', - '--include-from=-', - '--exclude=*', + '--files-from=-', config.source, config.host .. ':' .. config.targetdir )