| 133 | } |
| 134 | |
| 135 | func (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 | } |