From 0bfd70c405487df1028fc0147e615594c243ea1a Mon Sep 17 00:00:00 2001 From: nielash Date: Fri, 19 Apr 2024 05:53:34 -0400 Subject: [PATCH] sync: remove now superfluous copyEmptyDirectories function --- fs/sync/sync.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/fs/sync/sync.go b/fs/sync/sync.go index 5d0bee896..0d1cfc6e6 100644 --- a/fs/sync/sync.go +++ b/fs/sync/sync.go @@ -696,38 +696,6 @@ func (s *syncCopyMove) deleteEmptyDirectories(ctx context.Context, f fs.Fs, entr return nil } -// This copies the empty directories in the slice passed in and logs -// any errors copying the directories -func copyEmptyDirectories(ctx context.Context, f fs.Fs, entries map[string]fs.DirEntry) error { - if len(entries) == 0 { - return nil - } - - var okCount int - for _, entry := range entries { - dir, ok := entry.(fs.Directory) - if ok { - err := operations.Mkdir(ctx, f, dir.Remote()) - if err != nil { - fs.Errorf(fs.LogDirName(f, dir.Remote()), "Failed to Mkdir: %v", err) - } else { - okCount++ - } - } else { - fs.Errorf(f, "Not a directory: %v", entry) - } - } - - if accounting.Stats(ctx).Errored() { - fs.Debugf(f, "failed to copy %d directories", accounting.Stats(ctx).GetErrors()) - } - - if okCount > 0 { - fs.Debugf(f, "copied %d directories", okCount) - } - return nil -} - // mark the parent of entry as not empty and if entry is a directory mark it as potentially empty. func (s *syncCopyMove) markParentNotEmpty(entry fs.DirEntry) { s.srcEmptyDirsMu.Lock() @@ -1006,10 +974,6 @@ func (s *syncCopyMove) run() error { s.stopTransfers() s.stopDeleters() - if s.copyEmptySrcDirs { - s.processError(copyEmptyDirectories(s.ctx, s.fdst, s.srcEmptyDirs)) - } - // Delete files after if s.deleteMode == fs.DeleteModeAfter { if s.currentError() != nil && !s.ci.IgnoreErrors {