MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / sync_project

Function sync_project

src/daemon/git_watch.rs:675–693  ·  view source on GitHub ↗

Opens the project store and runs a diff-scoped incremental sync (or a full sync when the diff base is missing / oversized). Returns true on success. `SyncLock` is treated as success (a peer synced). The `TraceDecay` sync/open futures are `Send` (the sync path scopes its `!Send` `gix` values so they drop before every `.await`; see `indexing::stamp_last_synced_commit`), so this awaits them directly

(root: &Path, opts: &TraceDecayOpenOptions, escalation: usize)

Source from the content-addressed store, hash-verified

673/// `indexing::stamp_last_synced_commit`), so this awaits them directly on the
674/// caller's task under the daemon-wide sync semaphore — no nested runtime.
675async fn sync_project(root: &Path, opts: &TraceDecayOpenOptions, escalation: usize) -> bool {
676 let Ok(cg) = TraceDecay::open_with_options(root, opts.clone()).await else {
677 return false;
678 };
679 let base = cg.last_synced_commit().await;
680 let result = match base {
681 Some(base) => match cg.stale_files_since_commit(&base, escalation) {
682 Some(files) if files.is_empty() => Ok(()),
683 Some(files) => cg.sync_if_stale_silent(&files).await,
684 // Base missing/unreachable or over the escalation limit → full.
685 None => cg.sync().await.map(|_| ()),
686 },
687 None => cg.sync().await.map(|_| ()),
688 };
689 matches!(
690 result,
691 Ok(()) | Err(crate::errors::TraceDecayError::SyncLock { .. })
692 )
693}
694
695/// Proactively tracks a linked worktree's branch. Returns the
696/// [`crate::branch::BranchAddOutcome`] name for logging, or `None` on error.

Callers 3

execute_planFunction · 0.85
degraded_poll_loopFunction · 0.85
tickFunction · 0.85

Calls 5

last_synced_commitMethod · 0.80
sync_if_stale_silentMethod · 0.80
syncMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected