The Git facts of a checkpoint, as recorded in a completion operation's `before`/`after` state (R3: the rollback re-derives the exact pre-completion checkpoint from these facts).
(
checkpoint: &super::workspace_txn::WorkspaceCheckpoint,
)
| 3146 | /// `before`/`after` state (R3: the rollback re-derives the exact |
| 3147 | /// pre-completion checkpoint from these facts). |
| 3148 | pub(super) fn checkpoint_git_state( |
| 3149 | checkpoint: &super::workspace_txn::WorkspaceCheckpoint, |
| 3150 | ) -> Result<GitStateRef, RepositoryError> { |
| 3151 | let oid = git_object_id_from_hex(&checkpoint.git_head)?; |
| 3152 | let head = match &checkpoint.git_head_symref { |
| 3153 | Some(symref) => GitHeadState::Attached { |
| 3154 | symref: symref.clone(), |
| 3155 | oid, |
| 3156 | }, |
| 3157 | None => GitHeadState::Detached { oid }, |
| 3158 | }; |
| 3159 | let index = match (&checkpoint.git_index_digest, &checkpoint.git_index_tree) { |
| 3160 | (Some(digest), tree) => { |
| 3161 | let digest = digest_from_evidence_string(digest)?; |
| 3162 | let tree = tree |
| 3163 | .as_ref() |
| 3164 | .map(|hex| git_object_id_from_hex(hex)) |
| 3165 | .transpose()?; |
| 3166 | Some(GitIndexState { digest, tree }) |
| 3167 | } |
| 3168 | (None, _) => None, |
| 3169 | }; |
| 3170 | Ok(GitStateRef { |
| 3171 | head, |
| 3172 | index, |
| 3173 | refs_digest: atomic_core::Hash::of(b"atomic:bridge-checkpoint-state"), |
| 3174 | }) |
| 3175 | } |
| 3176 | |
| 3177 | /// Parse a digest evidence string written by either checkpoint writer: the |
| 3178 | /// repository writer records base32 (`Hash::to_base32`), the CLI checkpoint |
no test coverage detected