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.
This commit is contained in:
Thomas Nixon 2020-03-17 00:01:44 +00:00
parent 42413cabbe
commit c4b5465622
1 changed files with 7 additions and 1 deletions

View File

@ -62,6 +62,7 @@ rsync.checkgauge = {
copy_dirlinks = true, copy_dirlinks = true,
copy_links = true, copy_links = true,
cvs_exclude = true, cvs_exclude = true,
delete_excluded = true,
dry_run = true, dry_run = true,
executability = true, executability = true,
existing = true, existing = true,
@ -316,7 +317,7 @@ rsync.init = function
local filters = inlet.hasFilters( ) and inlet.getFilters( ) local filters = inlet.hasFilters( ) and inlet.getFilters( )
local delete = nil local delete = {}
local target = config.target local target = config.target
@ -336,6 +337,11 @@ rsync.init = function
delete = { '--delete', '--ignore-errors' } delete = { '--delete', '--ignore-errors' }
end end
if config.rsync.delete_excluded == true
then
table.insert( delete, '--delete-excluded' )
end
if not filters and #excludes == 0 if not filters and #excludes == 0
then then
-- starts rsync without any filters or excludes -- starts rsync without any filters or excludes