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

Method acceptLocal

apps/cli/internal/sync/engine.go:238–261  ·  view source on GitHub ↗
(
	action SyncAction,
	extHash string,
	ts TaskState,
	state *SyncState,
	now time.Time,
)

Source from the content-addressed store, hash-verified

236}
237
238func (e *Engine) acceptLocal(
239 action SyncAction,
240 extHash string,
241 ts TaskState,
242 state *SyncState,
243 now time.Time,
244) (SyncAction, error) {
245 action.Reason = "updated"
246 if e.DryRun {
247 return action, nil
248 }
249
250 localHash, err := HashLocalFile(ts.FilePath)
251 if err != nil {
252 return SyncAction{}, fmt.Errorf("failed to hash local file: %w", err)
253 }
254
255 ts.ExternalHash = extHash
256 ts.LocalHash = localHash
257 ts.LastSynced = now
258 state.Tasks[action.ExternalID] = ts
259
260 return action, nil
261}
262
263func (e *Engine) recreateMissingFile(
264 action SyncAction,

Callers 1

resolveConflictMethod · 0.95

Calls 1

HashLocalFileFunction · 0.85

Tested by

no test coverage detected