Restore the Git evidence captured before synchronization. This is used when the final shim checkpoint cannot be refreshed after Git itself was aligned successfully.
(self, repo_root: &Path)
| 475 | /// when the final shim checkpoint cannot be refreshed after Git itself |
| 476 | /// was aligned successfully. |
| 477 | pub(crate) fn rollback(self, repo_root: &Path) -> CliResult<()> { |
| 478 | let Self::Synchronized(receipt) = self else { |
| 479 | return Ok(()); |
| 480 | }; |
| 481 | let git_repo = GitRepository::discover(repo_root).map_err(|error| { |
| 482 | git_error(format!( |
| 483 | "cannot reopen Git repository to roll back shadow switch: {error}" |
| 484 | )) |
| 485 | })?; |
| 486 | let failures = receipt.snapshot.restore(&git_repo, &receipt.target_ref); |
| 487 | if failures.is_empty() { |
| 488 | Ok(()) |
| 489 | } else { |
| 490 | Err(git_error(format!( |
| 491 | "failed to restore original Git state: {}", |
| 492 | failures.join("; ") |
| 493 | ))) |
| 494 | } |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | #[derive(Debug)] |
no test coverage detected