mirror of
https://github.com/rclone/rclone
synced 2024-12-23 14:23:44 +01:00
fs/operations: Don't update timestamps of files in --compare-dest
This commit is contained in:
parent
04aa6969a4
commit
40024990b7
@ -1408,7 +1408,9 @@ func compareDest(ctx context.Context, dst, src fs.Object, CompareDest fs.Fs) (No
|
||||
default:
|
||||
return false, err
|
||||
}
|
||||
if Equal(ctx, src, CompareDestFile) {
|
||||
opt := defaultEqualOpt(ctx)
|
||||
opt.updateModTime = false
|
||||
if equal(ctx, src, CompareDestFile, opt) {
|
||||
fs.Debugf(src, "Destination found in --compare-dest, skipping")
|
||||
return true, nil
|
||||
}
|
||||
|
@ -1496,19 +1496,29 @@ func TestSyncCompareDest(t *testing.T) {
|
||||
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4)
|
||||
|
||||
// check empty dest, old compare
|
||||
file5b := r.WriteFile("two", "twot3", t3)
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4)
|
||||
// check new dest, new compare, src timestamp differs
|
||||
file5b := r.WriteFile("two", "two", t3)
|
||||
fstest.CheckItems(t, r.Flocal, file1c, file5b)
|
||||
|
||||
accounting.GlobalStats().ResetCounters()
|
||||
err = Sync(ctx, fdst, r.Flocal, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
file5bdst := file5b
|
||||
file5bdst.Path = "dst/two"
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4)
|
||||
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4, file5bdst)
|
||||
// check empty dest, old compare
|
||||
file5c := r.WriteFile("two", "twot3", t3)
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4)
|
||||
fstest.CheckItems(t, r.Flocal, file1c, file5c)
|
||||
|
||||
accounting.GlobalStats().ResetCounters()
|
||||
err = Sync(ctx, fdst, r.Flocal, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
file5cdst := file5c
|
||||
file5cdst.Path = "dst/two"
|
||||
|
||||
fstest.CheckItems(t, r.Fremote, file2, file3, file4, file5cdst)
|
||||
}
|
||||
|
||||
// Test with multiple CompareDest
|
||||
|
Loading…
Reference in New Issue
Block a user