copy/sync: only create empty directories when they don't exist on the remote

Sync/copy now only creates empty directories when they don't exist on the remote (--create-empty-src-dirs flag) - fixes #2800
This commit is contained in:
Ishuah Kariuki 2020-03-03 19:24:22 +03:00 committed by GitHub
parent 1c800efbac
commit 0c6f14c694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -879,11 +879,15 @@ func (s *syncCopyMove) Match(ctx context.Context, dst, src fs.DirEntry) (recurse
// Do the same thing to the entire contents of the directory
_, ok := dst.(fs.Directory)
if ok {
// Only record matched (src & dst) empty dirs when performing move
if s.DoMove {
// Record the src directory for deletion
s.srcEmptyDirsMu.Lock()
s.srcParentDirCheck(src)
s.srcEmptyDirs[src.Remote()] = src
s.srcEmptyDirsMu.Unlock()
}
return true
}
// FIXME src is dir, dst is file