From ac830ddd4220d00f8e41e35e9b22e85a288c0574 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 9 Mar 2024 11:28:15 +0000 Subject: [PATCH] sync: don't sync directory modtimes from backends which don't have directories Some backends (like s3, swift, gcs, azureblob) don't have directories (this can be overridden on some using the directory markers feature). It therefore makes no sense to sync directory times from them as they will all be a value made up by rclone (--default-time) We use the feature flag CanHaveEmptyDirectories to mark backends without real directory support and disable the directory modification time syncing on those. --- fs/sync/sync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/sync/sync.go b/fs/sync/sync.go index 0c75415f4..5422927e5 100644 --- a/fs/sync/sync.go +++ b/fs/sync/sync.go @@ -154,8 +154,8 @@ func newSyncCopyMove(ctx context.Context, fdst, fsrc fs.Fs, deleteMode fs.Delete trackRenamesCh: make(chan fs.Object, ci.Checkers), checkFirst: ci.CheckFirst, setDirMetadata: ci.Metadata && fsrc.Features().ReadDirMetadata && fdst.Features().WriteDirMetadata, - setDirModTime: !ci.NoUpdateDirModTime && (fdst.Features().WriteDirSetModTime || fdst.Features().MkdirMetadata != nil || fdst.Features().DirSetModTime != nil), - setDirModTimeAfter: !ci.NoUpdateDirModTime && fdst.Features().DirModTimeUpdatesOnWrite, + setDirModTime: (!ci.NoUpdateDirModTime && fsrc.Features().CanHaveEmptyDirectories) && (fdst.Features().WriteDirSetModTime || fdst.Features().MkdirMetadata != nil || fdst.Features().DirSetModTime != nil), + setDirModTimeAfter: !ci.NoUpdateDirModTime && fsrc.Features().CanHaveEmptyDirectories && fdst.Features().DirModTimeUpdatesOnWrite, modifiedDirs: make(map[string]struct{}), }