From 20b00db3909906d782c3ee4f3c0aa5cfb4a92f23 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 5 Oct 2020 10:23:23 +0100 Subject: [PATCH] operations: fix spurious "--checksum is in use but the source and destination have no hashes in common" Before this change rclone would emit the message --checksum is in use but the source and destination have no hashes in common; falling back to --size-only When the source or destination hash was missing as well as when the source and destination had no hashes in common. This first case is very confusing for users when the source and destination do have a hash in common. This change fixes that and makes sure the error message is not emitted on missing hashes even when there is a hash in common. See: https://forum.rclone.org/t/source-and-destination-have-no-hashes-in-common-for-unencrypted-drive-to-local-sync/19531 --- fs/operations/operations.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index c762b3146..56e75d47c 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -181,9 +181,12 @@ func equal(ctx context.Context, src fs.ObjectInfo, dst fs.Object, opt equalOpt) return false } if ht == hash.None { - checksumWarning.Do(func() { - fs.Logf(dst.Fs(), "--checksum is in use but the source and destination have no hashes in common; falling back to --size-only") - }) + common := src.Fs().Hashes().Overlap(dst.Fs().Hashes()) + if common.Count() == 0 { + checksumWarning.Do(func() { + fs.Logf(dst.Fs(), "--checksum is in use but the source and destination have no hashes in common; falling back to --size-only") + }) + } fs.Debugf(src, "Size of src and dst objects identical") } else { fs.Debugf(src, "Size and %v of src and dst objects identical", ht)