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

Method stamp_last_synced_commit

src/tracedecay/indexing.rs:1179–1194  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1177 }
1178
1179 async fn stamp_last_synced_commit(&self) {
1180 // Scope the gix values so they drop before the `.await`:
1181 // `gix::Repository`/`Commit` are `!Send`, and holding them across the
1182 // await would make every sync future `!Send`, breaking `tokio::spawn`
1183 // of anything that syncs (sync-on-read, scheduler, git watcher).
1184 let hex_oid = {
1185 let Ok(repo) = gix::open(&self.project_root) else {
1186 return;
1187 };
1188 let Ok(head) = repo.head_commit() else {
1189 return;
1190 };
1191 head.id().to_hex().to_string()
1192 };
1193 let _ = self.db.set_metadata("last_synced_commit", &hex_oid).await;
1194 }
1195
1196 /// Returns the git HEAD commit id recorded at the last successful sync,
1197 /// or `None` if it was never stamped (e.g. index predates this feature,

Callers 3

sync_single_filesMethod · 0.80

Calls 2

set_metadataMethod · 0.80
idMethod · 0.45

Tested by

no test coverage detected