1
0
mirror of https://github.com/rclone/rclone.git synced 2025-01-19 04:47:54 +02:00

Implement --ignore-checksum flag

Fixes  Fixes  Fixes 
This commit is contained in:
Nick Craig-Wood 2017-01-05 17:32:42 +00:00
parent 916569102c
commit 9d331ce04b
3 changed files with 13 additions and 1 deletions

@ -313,6 +313,15 @@ Do a trial run with no permanent changes. Use this to see what rclone
would do without actually doing it. Useful when setting up the `sync`
command which deletes files in the destination.
### --ignore-checksum ###
Normally rclone will check that the checksums of transferred files
match, and give an error "corrupted on transfer" if they don't.
You can use this option to skip that check. You should only use it if
you have had the "corrupted on transfer" error message and you are
sure you might want to transfer potentially corrupted data.
### --ignore-existing ###
Using this option will make rclone unconditionally skip all files

@ -83,6 +83,7 @@ var (
noGzip = BoolP("no-gzip-encoding", "", false, "Don't set Accept-Encoding: gzip.")
maxDepth = IntP("max-depth", "", -1, "If set limits the recursion depth to this.")
ignoreSize = BoolP("ignore-size", "", false, "Ignore size when skipping use mod-time or checksum.")
ignoreChecksum = BoolP("ignore-checksum", "", false, "Skip post copy check of checksums.")
noTraverse = BoolP("no-traverse", "", false, "Don't traverse destination file system on copy.")
noUpdateModTime = BoolP("no-update-modtime", "", false, "Don't update destination mod-time if files identical.")
backupDir = StringP("backup-dir", "", "", "Make backups into hierarchy based in DIR.")
@ -207,6 +208,7 @@ type ConfigInfo struct {
NoGzip bool // Disable compression
MaxDepth int
IgnoreSize bool
IgnoreChecksum bool
NoTraverse bool
NoUpdateModTime bool
DataRateUnit string
@ -308,6 +310,7 @@ func LoadConfig() {
Config.NoGzip = *noGzip
Config.MaxDepth = *maxDepth
Config.IgnoreSize = *ignoreSize
Config.IgnoreChecksum = *ignoreChecksum
Config.NoTraverse = *noTraverse
Config.NoUpdateModTime = *noUpdateModTime
Config.BackupDir = *backupDir

@ -331,7 +331,7 @@ func Copy(f Fs, dst Object, remote string, src Object) (err error) {
if err != nil {
Stats.Error()
ErrorLog(dst, "Failed to read hash: %v", err)
} else if !HashEquals(srcSum, dstSum) {
} else if !Config.IgnoreSize && !HashEquals(srcSum, dstSum) {
Stats.Error()
err = errors.Errorf("corrupted on transfer: %v hash differ %q vs %q", hashType, srcSum, dstSum)
ErrorLog(dst, "%v", err)