From f9ceade9b4c91bb6184aff8e48a98b3fc9c98745 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 10 Aug 2019 10:40:12 +0100 Subject: [PATCH] operations: don't calculate checksums when using --ignore-checksum #3419 Before this change we calculated the checkums when using --ignore-checksum but ignored them at the end. Now we don't calculate the checksums at all which is more efficient. --- fs/operations/operations.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index 28d7c0499..fd0293d91 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -282,7 +282,7 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj // work out which hash to use - limit to 1 hash in common var common hash.Set hashType := hash.None - if !fs.Config.SizeOnly { + if !fs.Config.SizeOnly && !fs.Config.IgnoreChecksum { common = src.Fs().Hashes().Overlap(f.Hashes()) if common.Count() > 0 { hashType = common.GetOne() @@ -392,7 +392,7 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj } // Verify hashes are the same after transfer - ignoring blank hashes - if !fs.Config.IgnoreChecksum && hashType != hash.None { + if hashType != hash.None { // checkHashes has logged and counted errors equal, _, srcSum, dstSum, _ := checkHashes(ctx, src, dst, hashType) if !equal {