MCPcopy Index your code
hub / github.com/rclone/rclone / markParentNotEmpty

Method markParentNotEmpty

fs/sync/sync.go:700–735  ·  view source on GitHub ↗

mark the parent of entry as not empty and if entry is a directory mark it as potentially empty.

(entry fs.DirEntry)

Source from the content-addressed store, hash-verified

698
699// mark the parent of entry as not empty and if entry is a directory mark it as potentially empty.
700func (s *syncCopyMove) markParentNotEmpty(entry fs.DirEntry) {
701 s.srcEmptyDirsMu.Lock()
702 defer s.srcEmptyDirsMu.Unlock()
703 // Mark entry as potentially empty if it is a directory
704 _, isDir := entry.(fs.Directory)
705 if isDir {
706 s.srcEmptyDirs[entry.Remote()] = entry
707 // if DoMove and --delete-empty-src-dirs flag is set then record the parent but
708 // don't remove any as we are about to move files out of them them making the
709 // directory empty.
710 if s.DoMove && s.deleteEmptySrcDirs {
711 s.srcMoveEmptyDirs[entry.Remote()] = entry
712 }
713 }
714 parentDir := path.Dir(entry.Remote())
715 if isDir && s.copyEmptySrcDirs {
716 // Mark its parent as not empty
717 if parentDir == "." {
718 parentDir = ""
719 }
720 delete(s.srcEmptyDirs, parentDir)
721 }
722 if !isDir {
723 // Mark ALL its parents as not empty
724 for {
725 if parentDir == "." {
726 parentDir = ""
727 }
728 delete(s.srcEmptyDirs, parentDir)
729 if parentDir == "" || parentDir == "/" {
730 break
731 }
732 parentDir = path.Dir(parentDir)
733 }
734 }
735}
736
737// parseTrackRenamesStrategy turns a config string into a trackRenamesStrategy
738func parseTrackRenamesStrategy(strategies string) (strategy trackRenamesStrategy, err error) {

Callers 3

copyDirMetadataMethod · 0.95
SrcOnlyMethod · 0.95
MatchMethod · 0.95

Calls 4

DirMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
RemoteMethod · 0.65

Tested by

no test coverage detected