MCPcopy Create free account
hub / github.com/driangle/taskmd / recreateMissingFile

Method recreateMissingFile

apps/cli/internal/sync/engine.go:263–294  ·  view source on GitHub ↗
(
	action SyncAction,
	ext ExternalTask,
	mapped MappedTask,
	extHash string,
	ts TaskState,
	state *SyncState,
	now time.Time,
)

Source from the content-addressed store, hash-verified

261}
262
263func (e *Engine) recreateMissingFile(
264 action SyncAction,
265 ext ExternalTask,
266 mapped MappedTask,
267 extHash string,
268 ts TaskState,
269 state *SyncState,
270 now time.Time,
271) (SyncAction, error) {
272 action.Reason = "created"
273 if e.DryRun {
274 return action, nil
275 }
276
277 filePath, err := WriteTaskFile(filepath.Dir(ts.FilePath), ts.LocalID, mapped, ext.ExternalID, state.Source)
278 if err != nil {
279 return SyncAction{}, err
280 }
281
282 localHash, err := HashLocalFile(filePath)
283 if err != nil {
284 return SyncAction{}, err
285 }
286
287 ts.FilePath = filePath
288 ts.ExternalHash = extHash
289 ts.LocalHash = localHash
290 ts.LastSynced = now
291 state.Tasks[ext.ExternalID] = ts
292
293 return action, nil
294}
295
296func (e *Engine) applyExternalUpdate(
297 action SyncAction,

Callers 1

updateTaskMethod · 0.95

Calls 2

WriteTaskFileFunction · 0.85
HashLocalFileFunction · 0.85

Tested by

no test coverage detected