sync: Track and perform server-side renames

This commits adds support for tracking of file renames if `track-renames` flag is set,
and it then performs server-side renames for remotes that support it, i.e.
remotes that implement either the `Mover` or the `Copier` interface.

Fixes #888
This commit is contained in:
Bjørn Erik Pedersen
2017-01-03 20:35:05 +00:00
committed by Nick Craig-Wood
parent 5c89fd679d
commit 47d3a450a4
5 changed files with 156 additions and 11 deletions
+6 -2
View File
@@ -109,13 +109,17 @@ func CheckHashes(src, dst Object) (equal bool, hash HashType, err error) {
// Otherwise the file is considered to be not equal including if there
// were errors reading info.
func Equal(src, dst Object) bool {
return equal(src, dst, Config.SizeOnly, Config.CheckSum)
}
func equal(src, dst Object, sizeOnly, checkSum bool) bool {
if !Config.IgnoreSize {
if src.Size() != dst.Size() {
Debug(src, "Sizes differ")
return false
}
}
if Config.SizeOnly {
if sizeOnly {
Debug(src, "Sizes identical")
return true
}
@@ -123,7 +127,7 @@ func Equal(src, dst Object) bool {
// Assert: Size is equal or being ignored
// If checking checksum and not modtime
if Config.CheckSum {
if checkSum {
// Check the hash
same, hash, _ := CheckHashes(src, dst)
if !same {