( ext ExternalTask, mapped MappedTask, extHash string, ts TaskState, state *SyncState, now time.Time, )
| 179 | } |
| 180 | |
| 181 | func (e *Engine) updateTask( |
| 182 | ext ExternalTask, |
| 183 | mapped MappedTask, |
| 184 | extHash string, |
| 185 | ts TaskState, |
| 186 | state *SyncState, |
| 187 | now time.Time, |
| 188 | ) (SyncAction, error) { |
| 189 | action := SyncAction{ |
| 190 | ExternalID: ext.ExternalID, |
| 191 | LocalID: ts.LocalID, |
| 192 | FilePath: ts.FilePath, |
| 193 | Title: ext.Title, |
| 194 | } |
| 195 | |
| 196 | extChanged := extHash != ts.ExternalHash |
| 197 | |
| 198 | localChanged, err := e.localFileChanged(ts) |
| 199 | if err != nil { |
| 200 | if os.IsNotExist(err) { |
| 201 | return e.recreateMissingFile(action, ext, mapped, extHash, ts, state, now) |
| 202 | } |
| 203 | return SyncAction{}, fmt.Errorf("failed to check local file: %w", err) |
| 204 | } |
| 205 | |
| 206 | if !extChanged && !localChanged { |
| 207 | action.Reason = "skipped" |
| 208 | return action, nil |
| 209 | } |
| 210 | |
| 211 | if localChanged { |
| 212 | return e.resolveConflict(action, ext, mapped, extHash, ts, state, now) |
| 213 | } |
| 214 | |
| 215 | return e.applyExternalUpdate(action, ext, mapped, extHash, ts, state, now) |
| 216 | } |
| 217 | |
| 218 | func (e *Engine) resolveConflict( |
| 219 | action SyncAction, |
no test coverage detected