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

Function watcher_sync

tests/daemon_suite/git_watch_test.rs:101–115  ·  view source on GitHub ↗

The watcher's sync-execution logic, reproduced faithfully: diff-scope from `last_synced_commit` when possible, else a full sync. This is the exact decision `git_watch::sync_project` makes; testing it here proves the freshness contract without reaching into the crate-private watcher.

(project: &Path, escalation: usize)

Source from the content-addressed store, hash-verified

99/// decision `git_watch::sync_project` makes; testing it here proves the freshness
100/// contract without reaching into the crate-private watcher.
101async fn watcher_sync(project: &Path, escalation: usize) {
102 let cg = TraceDecay::open(project).await.unwrap();
103 match cg.last_synced_commit().await {
104 Some(base) => match cg.stale_files_since_commit(&base, escalation) {
105 Some(files) if files.is_empty() => {}
106 Some(files) => cg.sync_if_stale_silent(&files).await.unwrap(),
107 None => {
108 cg.sync().await.unwrap();
109 }
110 },
111 None => {
112 cg.sync().await.unwrap();
113 }
114 }
115}
116
117/// Unhooked `git commit` → the watcher's diff-scoped sync makes the new symbol
118/// searchable.

Callers 1

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