mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
operations: warn if --checksum is set but there are no hashes available
Also caveat the help of --checksum Fixes #2903
This commit is contained in:
@@ -104,6 +104,8 @@ func sizeDiffers(src, dst fs.ObjectInfo) bool {
|
||||
return src.Size() != dst.Size()
|
||||
}
|
||||
|
||||
var checksumWarning sync.Once
|
||||
|
||||
func equal(src fs.ObjectInfo, dst fs.Object, sizeOnly, checkSum bool) bool {
|
||||
if sizeDiffers(src, dst) {
|
||||
fs.Debugf(src, "Sizes differ (src %d vs dst %d)", src.Size(), dst.Size())
|
||||
@@ -125,6 +127,9 @@ func equal(src fs.ObjectInfo, dst fs.Object, sizeOnly, checkSum bool) bool {
|
||||
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")
|
||||
})
|
||||
fs.Debugf(src, "Size of src and dst objects identical")
|
||||
} else {
|
||||
fs.Debugf(src, "Size and %v of src and dst objects identical", ht)
|
||||
|
||||
Reference in New Issue
Block a user