(ctx context.Context)
| 29 | } |
| 30 | |
| 31 | func (b *bisyncRun) setCompareDefaults(ctx context.Context) (err error) { |
| 32 | ci := fs.GetConfig(ctx) |
| 33 | |
| 34 | // defaults |
| 35 | b.opt.Compare.Size = true |
| 36 | b.opt.Compare.Modtime = true |
| 37 | b.opt.Compare.Checksum = false |
| 38 | |
| 39 | if ci.SizeOnly { |
| 40 | b.opt.Compare.Size = true |
| 41 | b.opt.Compare.Modtime = false |
| 42 | b.opt.Compare.Checksum = false |
| 43 | } else if ci.CheckSum && !b.opt.IgnoreListingChecksum { |
| 44 | b.opt.Compare.Size = true |
| 45 | b.opt.Compare.Modtime = false |
| 46 | b.opt.Compare.Checksum = true |
| 47 | } |
| 48 | |
| 49 | if ci.IgnoreSize { |
| 50 | b.opt.Compare.Size = false |
| 51 | } |
| 52 | |
| 53 | err = b.setFromCompareFlag(ctx) |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | if b.fs1.Features().SlowHash || b.fs2.Features().SlowHash { |
| 59 | b.opt.Compare.SlowHashDetected = true |
| 60 | } |
| 61 | if b.opt.Compare.Checksum && !b.opt.IgnoreListingChecksum { |
| 62 | b.setHashType(ci) |
| 63 | } |
| 64 | |
| 65 | if b.opt.Compare.SlowHashSyncOnly && b.opt.Compare.SlowHashDetected && b.opt.Resync { |
| 66 | fs.Log(nil, Color(terminal.Dim, "Ignoring checksums during --resync as --slow-hash-sync-only is set.")) |
| 67 | ci.CheckSum = false |
| 68 | // note not setting b.opt.Compare.Checksum = false as we still want to build listings on the non-slow side, if any |
| 69 | } else if b.opt.Compare.Checksum && !ci.CheckSum { |
| 70 | fs.Log(nil, Color(terminal.YellowFg, "WARNING: Checksums will be compared for deltas but not during sync as --checksum is not set.")) |
| 71 | } |
| 72 | if b.opt.Compare.Modtime && (b.fs1.Precision() == fs.ModTimeNotSupported || b.fs2.Precision() == fs.ModTimeNotSupported) { |
| 73 | fs.Log(nil, Color(terminal.YellowFg, "WARNING: Modtime compare was requested but at least one remote does not support it. It is recommended to use --checksum or --size-only instead.")) |
| 74 | } |
| 75 | if (ci.CheckSum || b.opt.Compare.Checksum) && b.opt.IgnoreListingChecksum { |
| 76 | if (b.opt.Compare.HashType1 == hash.None || b.opt.Compare.HashType2 == hash.None) && !b.opt.Compare.DownloadHash { |
| 77 | fs.Logf(nil, Color(terminal.YellowFg, `WARNING: Checksum compare was requested but at least one remote does not support checksums (or checksums are being ignored) and --ignore-listing-checksum is set. |
| 78 | Ignoring Checksums globally and falling back to --compare modtime,size for sync. (Use --compare size or --size-only to ignore modtime). Path1 (%s): %s, Path2 (%s): %s`), |
| 79 | b.fs1.String(), b.opt.Compare.HashType1.String(), b.fs2.String(), b.opt.Compare.HashType2.String()) |
| 80 | b.opt.Compare.Modtime = true |
| 81 | b.opt.Compare.Size = true |
| 82 | ci.CheckSum = false |
| 83 | b.opt.Compare.Checksum = false |
| 84 | } else { |
| 85 | fs.Log(nil, Color(terminal.YellowFg, "WARNING: Ignoring checksum for deltas as --ignore-listing-checksum is set")) |
| 86 | // note: --checksum will still affect the internal sync calls |
| 87 | } |
| 88 | } |
no test coverage detected