MCPcopy Index your code
hub / github.com/devspace-sh/devspace / shouldDownload

Function shouldDownload

pkg/devspace/sync/evaluater.go:88–110  ·  view source on GitHub ↗

s.fileIndex needs to be locked before this function is called

(change *remote.Change, s *Sync)

Source from the content-addressed store, hash-verified

86
87// s.fileIndex needs to be locked before this function is called
88func shouldDownload(change *remote.Change, s *Sync) bool {
89 // Does file already exist in the filemap?
90 if s.fileIndex.fileMap[change.Path] != nil {
91 // Don't override folders that exist in the filemap
92 if !change.IsDir {
93 // Redownload file if mtime is newer than saved one
94 if change.MtimeUnix > s.fileIndex.fileMap[change.Path].Mtime {
95 return true
96 }
97
98 // Redownload file if size changed && file is not older than the one in the fileMap
99 // the mTime check is necessary, because otherwise we would override older local files that
100 // are not overridden initially
101 if change.MtimeUnix == s.fileIndex.fileMap[change.Path].Mtime && change.Size != s.fileIndex.fileMap[change.Path].Size {
102 return true
103 }
104 }
105
106 return false
107 }
108
109 return true
110}
111
112// s.fileIndex needs to be locked before this function is called
113// A file is only deleted if the following conditions are met:

Callers 1

shouldKeepMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected