"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
filter: warn the user if he use --include and --exclude together fixes #1764
Ernest Borowski934df67aef51
diff --git a/docs/content/filtering.md b/docs/content/filtering.mdindex 5898134a2..0ffe71384 100644--- a/docs/content/filtering.md+++ b/docs/content/filtering.md@@ -167,6 +167,9 @@ type.* `--filter`* `--filter-from`+**Important** You should not use `--include*` together with `--exclude*`.+It may produce different results than you expected. In that case try to use: `--filter*`.+Note that all the options of the same type are processed together inthe order above, regardless of what order they were placed on thecommand line.diff --git a/fs/filter.go b/fs/filter.goindex 966d014bf..ad4221cfa 100644--- a/fs/filter.go+++ b/fs/filter.go@@ -156,6 +156,7 @@ func NewFilter() (f *Filter, err error) {MaxSize: int64(maxSize),}addImplicitExclude := false+ foundExcludeRule := falseif includeRule != nil {for _, rule := range *includeRule {@@ -183,6 +184,7 @@ func NewFilter() (f *Filter, err error) {if err != nil {return nil, err}+ foundExcludeRule = true}}if excludeFrom != nil {@@ -193,8 +195,14 @@ func NewFilter() (f *Filter, err error) {if err != nil {return nil, err}+ foundExcludeRule = true}}++ if addImplicitExclude && foundExcludeRule {+ Infof(nil, "Using --filter is recommended instead of both --include and --exclude as the order they are parsed in is indeterminate")+ }+if filterRule != nil {for _, rule := range *filterRule {err = f.AddRule(rule)