"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
operations: add logs when need to upload files to set mod times #1505
Nick Craig-Wood2b7994e73937
diff --git a/fs/operations/operations.go b/fs/operations/operations.goindex da2813827..b899e755d 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -151,6 +151,15 @@ func defaultEqualOpt() equalOpt {}}+var modTimeUploadOnce sync.Once++// emit a log if we are about to upload a file to set its modification time+func logModTimeUpload(dst fs.Object) {+ modTimeUploadOnce.Do(func() {+ fs.Logf(dst.Fs(), "Forced to upload files to set modification times on this backend.")+ })+}+func equal(ctx context.Context, src fs.ObjectInfo, dst fs.Object, opt equalOpt) bool {if sizeDiffers(src, dst) {fs.Debugf(src, "Sizes differ (src %d vs dst %d)", src.Size(), dst.Size())@@ -223,10 +232,12 @@ func equal(ctx context.Context, src fs.ObjectInfo, dst fs.Object, opt equalOpt)// Update the mtime of the dst object hereerr := dst.SetModTime(ctx, srcModTime)if err == fs.ErrorCantSetModTime {- fs.Debugf(dst, "src and dst identical but can't set mod time without re-uploading")+ logModTimeUpload(dst)+ fs.Infof(dst, "src and dst identical but can't set mod time without re-uploading")return false} else if err == fs.ErrorCantSetModTimeWithoutDelete {- fs.Debugf(dst, "src and dst identical but can't set mod time without deleting and re-uploading")+ logModTimeUpload(dst)+ fs.Infof(dst, "src and dst identical but can't set mod time without deleting and re-uploading")// Remove the file if BackupDir isn't set. If BackupDir is set we would rather have the old file// put in the BackupDir than deleted which is what will happen if we don't delete it.if fs.Config.BackupDir == "" {