Whether a shim operation is still in flight in the operation journal (durable but not yet verified). RFC §11.2 rule 5: events attributable to an in-flight operation are suppressed — the native path uses this journal evidence instead of a time window. The daemon defers reacting until the journal shows every repository- and working-copy-scope head verified or recovered; the ordinary writable-open pa
(
repository: &atomic_repository::Repository,
)
| 182 | /// after a daemon crash is just as much un-attributed in-flight work as a |
| 183 | /// repository head, and a diverged head set must defer too. |
| 184 | pub(crate) fn head_operation_in_flight( |
| 185 | repository: &atomic_repository::Repository, |
| 186 | ) -> CliResult<Option<String>> { |
| 187 | use atomic_core::operation::OperationScope; |
| 188 | use atomic_repository::repository::OperationVerificationState; |
| 189 | |
| 190 | let repository_log = repository |
| 191 | .operation_log(OperationScope::Repository, Some(1), false) |
| 192 | .map_err(CliError::Repository)?; |
| 193 | let in_flight = repository_log |
| 194 | .entries |
| 195 | .iter() |
| 196 | .find(|entry| entry.is_head) |
| 197 | .filter(|entry| !matches!(entry.verification, OperationVerificationState::Verified)) |
| 198 | .map(|entry| entry.operation.id().to_string()); |
| 199 | if in_flight.is_some() { |
| 200 | return Ok(in_flight); |
| 201 | } |
| 202 | // The working-copy scope: the daemon runs against this worktree, so its |
| 203 | // own prior pass's operation (crashed before verification) lives here. |
| 204 | let working_copy = repository |
| 205 | .require_working_copy_id() |
| 206 | .map_err(CliError::Repository)?; |
| 207 | let working_copy_log = repository |
| 208 | .operation_log(OperationScope::WorkingCopy(working_copy), Some(1), false) |
| 209 | .map_err(CliError::Repository)?; |
| 210 | Ok(working_copy_log |
| 211 | .entries |
| 212 | .iter() |
| 213 | .find(|entry| entry.is_head) |
| 214 | .filter(|entry| !matches!(entry.verification, OperationVerificationState::Verified)) |
| 215 | .map(|entry| entry.operation.id().to_string())) |
| 216 | } |
| 217 | |
| 218 | /// Wait until the Git metadata state is quiescent (RFC §11.2 rule 3: no |
| 219 | /// Git index lock, no ref locks, no sequence markers) and has stayed |