( action SyncAction, ext ExternalTask, mapped MappedTask, extHash string, ts TaskState, state *SyncState, now time.Time, )
| 294 | } |
| 295 | |
| 296 | func (e *Engine) applyExternalUpdate( |
| 297 | action SyncAction, |
| 298 | ext ExternalTask, |
| 299 | mapped MappedTask, |
| 300 | extHash string, |
| 301 | ts TaskState, |
| 302 | state *SyncState, |
| 303 | now time.Time, |
| 304 | ) (SyncAction, error) { |
| 305 | action.Reason = "updated" |
| 306 | if e.DryRun { |
| 307 | return action, nil |
| 308 | } |
| 309 | |
| 310 | if err := UpdateSyncedTaskFile(ts.FilePath, mapped); err != nil { |
| 311 | return SyncAction{}, fmt.Errorf("failed to update task file: %w", err) |
| 312 | } |
| 313 | |
| 314 | localHash, err := HashLocalFile(ts.FilePath) |
| 315 | if err != nil { |
| 316 | return SyncAction{}, fmt.Errorf("failed to hash updated file: %w", err) |
| 317 | } |
| 318 | |
| 319 | ts.ExternalHash = extHash |
| 320 | ts.LocalHash = localHash |
| 321 | ts.LastSynced = now |
| 322 | state.Tasks[ext.ExternalID] = ts |
| 323 | |
| 324 | return action, nil |
| 325 | } |
| 326 | |
| 327 | func (e *Engine) localFileChanged(ts TaskState) (bool, error) { |
| 328 | currentHash, err := HashLocalFile(ts.FilePath) |
no test coverage detected