From c4b546562271fadd4209f4cf1f39d352851bde2f Mon Sep 17 00:00:00 2001 From: Thomas Nixon Date: Tue, 17 Mar 2020 00:01:44 +0000 Subject: [PATCH] allow deleting excluded files with rsync This option can't be added to both init and action, because the rsync exclude mechanism is used to select the files to send, so would delete all non-changed files. It's only relevant during init anyway, as after that no excluded files will be made on the destination. --- default-rsync.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/default-rsync.lua b/default-rsync.lua index 106c58d..f846b44 100644 --- a/default-rsync.lua +++ b/default-rsync.lua @@ -62,6 +62,7 @@ rsync.checkgauge = { copy_dirlinks = true, copy_links = true, cvs_exclude = true, + delete_excluded = true, dry_run = true, executability = true, existing = true, @@ -316,7 +317,7 @@ rsync.init = function local filters = inlet.hasFilters( ) and inlet.getFilters( ) - local delete = nil + local delete = {} local target = config.target @@ -336,6 +337,11 @@ rsync.init = function delete = { '--delete', '--ignore-errors' } end + if config.rsync.delete_excluded == true + then + table.insert( delete, '--delete-excluded' ) + end + if not filters and #excludes == 0 then -- starts rsync without any filters or excludes