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

Method gatherChanges

pkg/devspace/watch/watch.go:135–168  ·  view source on GitHub ↗
(newState map[string]os.FileInfo)

Source from the content-addressed store, hash-verified

133}
134
135func (w *watcher) gatherChanges(newState map[string]os.FileInfo) ([]string, []string) {
136 changed := make([]string, 0, 1)
137 deleted := make([]string, 0, 1)
138
139 // Get changed paths
140 for file, fileInfo := range newState {
141 oldFileInfo, ok := w.FileMap[file]
142
143 // If existed before
144 if ok && oldFileInfo.IsDir() == fileInfo.IsDir() {
145 // If directory or file with same size and modification date
146 if oldFileInfo.IsDir() || (oldFileInfo.Size() == fileInfo.Size() && oldFileInfo.ModTime().UnixNano() == fileInfo.ModTime().UnixNano()) {
147 continue
148 }
149 } else if strings.HasPrefix(file, ".devspace") {
150 continue
151 }
152
153 changed = append(changed, file)
154 }
155
156 // Get deleted paths
157 for file := range w.FileMap {
158 if _, ok := newState[file]; !ok {
159 if strings.HasPrefix(file, ".devspace") {
160 continue
161 }
162
163 deleted = append(deleted, file)
164 }
165 }
166
167 return changed, deleted
168}

Callers 1

UpdateMethod · 0.95

Calls 3

IsDirMethod · 0.45
SizeMethod · 0.45
ModTimeMethod · 0.45

Tested by

no test coverage detected