(&self)
| 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, |
no test coverage detected