MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / rollback

Method rollback

atomic-cli/src/commands/git/shadow.rs:477–495  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)]

Callers 1

checkpoint_shadow_switchFunction · 0.80

Calls 3

git_errorFunction · 0.70
restoreMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected