"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fs: fix duplicate files causing spurious copies
Nick Craig-Wood00fe6d95daad
diff --git a/fs/march.go b/fs/march.goindex cc117d34e..80babf936 100644--- a/fs/march.go+++ b/fs/march.go@@ -268,20 +268,22 @@ func matchListings(srcListEntries, dstListEntries DirEntries, transforms []matchprev := srcList[iSrc-1].nameif srcName == prev {Logf(src, "Duplicate %s found in source - ignoring", DirEntryType(src))- src = nil // ignore the src+ iDst-- // ignore the src and retry the dst+ continue} else if srcName < prev {- Errorf(src, "Out of order listing in source")- src = nil // ignore the src+ // this should never happen since we sort the listings+ panic("Out of order listing in source")}}if dst != nil && iDst > 0 {prev := dstList[iDst-1].nameif dstName == prev {Logf(dst, "Duplicate %s found in destination - ignoring", DirEntryType(dst))- dst = nil // ignore the dst+ iSrc-- // ignore the dst and retry the src+ continue} else if dstName < prev {- Errorf(dst, "Out of order listing in destination")- dst = nil // ignore the dst+ // this should never happen since we sort the listings+ panic("Out of order listing in destination")}}if src != nil && dst != nil {diff --git a/fs/march_test.go b/fs/march_test.goindex b07fa5178..802d3934c 100644--- a/fs/march_test.go+++ b/fs/march_test.go@@ -101,11 +101,15 @@ func TestMatchListings(t *testing.T) {{what: "One duplicate",input: DirEntries{+ A, A,a, a,a, nil,+ b, b,},matches: []matchPair{+ {A, A},{a, a},+ {b, b},},},{@@ -141,20 +145,6 @@ func TestMatchListings(t *testing.T) {},transforms: []matchTransformFn{strings.ToLower},},- /*{- what: "Out of order",- input: DirEntries{- c, nil,- b, b,- a, nil,- },- srcOnly: DirEntries{- c,- },- dstOnly: DirEntries{- b,- },- },*/} {var srcList, dstList DirEntriesfor i := 0; i < len(test.input); i += 2 {