"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
walk: fix duplicate directories with --fast-list when directories are listed after their contents
Nick Craig-Wooda49c1f8b305a
diff --git a/fs/walk/walk.go b/fs/walk/walk.goindex 4cbef9079..aac111f54 100644--- a/fs/walk/walk.go+++ b/fs/walk/walk.go@@ -503,10 +503,12 @@ func walkRDirTree(ctx context.Context, f fs.Fs, startPath string, includeAll booreturn err}if inc || includeAll {- // If the directory doesn't exist already, create it- _, obj := dirs.Find(dirPath)- if obj == nil {- dirs.AddDir(fs.NewDir(dirPath, time.Now()))+ // Make sure the directory is in the tree. Its+ // entry in the parent is added by CheckParents+ // if not listed, as directories can be listed+ // after the objects in them.+ if _, ok := dirs[dirPath]; !ok {+ dirs[dirPath] = nil}}}diff --git a/fs/walk/walk_test.go b/fs/walk/walk_test.goindex 1906d16d3..349e36dec 100644--- a/fs/walk/walk_test.go+++ b/fs/walk/walk_test.go@@ -649,6 +649,39 @@ a/b2/a/b1/a/b2/+`,+ level: -1,+ exclude: ".bzEmpty",+ },+ {+ // Directories listed after the objects in them+ entries: fs.DirEntries{+ mockobject.Object("a/b/c/d"),+ mockdir.New("a"),+ mockdir.New("a/b"),+ mockdir.New("a/b/c"),+ },+ want: `/+ a/+a/+ b/+a/b/+`,+ level: 2,+ },+ {+ // Directories listed after the excluded objects in them+ entries: fs.DirEntries{+ mockobject.Object("a/.bzEmpty"),+ mockobject.Object("a/b/.bzEmpty"),+ mockdir.New("a"),+ mockdir.New("a/b"),+ },+ want: `/+ a/+a/+ b/+a/b/`,level: -1,exclude: ".bzEmpty",