"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
fs/operations: Don't update timestamps of files in --compare-dest
Nick Gaya40024990b73a
diff --git a/fs/operations/operations.go b/fs/operations/operations.goindex 0547ab9ab..c3c353aff 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -1408,7 +1408,9 @@ func compareDest(ctx context.Context, dst, src fs.Object, CompareDest fs.Fs) (Nodefault:return false, err}- if Equal(ctx, src, CompareDestFile) {+ opt := defaultEqualOpt(ctx)+ opt.updateModTime = false+ if equal(ctx, src, CompareDestFile, opt) {fs.Debugf(src, "Destination found in --compare-dest, skipping")return true, nil}diff --git a/fs/sync/sync_test.go b/fs/sync/sync_test.goindex 6a8caec5f..a2d2933bb 100644--- a/fs/sync/sync_test.go+++ b/fs/sync/sync_test.go@@ -1496,19 +1496,29 @@ func TestSyncCompareDest(t *testing.T) {fstest.CheckItems(t, r.Fremote, file2, file3, file4)+ // check new dest, new compare, src timestamp differs+ file5b := r.WriteFile("two", "two", t3)+ fstest.CheckItems(t, r.Flocal, file1c, file5b)++ accounting.GlobalStats().ResetCounters()+ err = Sync(ctx, fdst, r.Flocal, false)+ require.NoError(t, err)++ fstest.CheckItems(t, r.Fremote, file2, file3, file4)+// check empty dest, old compare- file5b := r.WriteFile("two", "twot3", t3)+ file5c := r.WriteFile("two", "twot3", t3)fstest.CheckItems(t, r.Fremote, file2, file3, file4)- fstest.CheckItems(t, r.Flocal, file1c, file5b)+ fstest.CheckItems(t, r.Flocal, file1c, file5c)accounting.GlobalStats().ResetCounters()err = Sync(ctx, fdst, r.Flocal, false)require.NoError(t, err)- file5bdst := file5b- file5bdst.Path = "dst/two"+ file5cdst := file5c+ file5cdst.Path = "dst/two"- fstest.CheckItems(t, r.Fremote, file2, file3, file4, file5bdst)+ fstest.CheckItems(t, r.Fremote, file2, file3, file4, file5cdst)}// Test with multiple CompareDest