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

Function read_checkpoint

atomic-cli/src/commands/git/checkpoint.rs:226–234  ·  view source on GitHub ↗

Read and upgrade a local checkpoint without rewriting it.

(root: &Path)

Source from the content-addressed store, hash-verified

224
225/// Read and upgrade a local checkpoint without rewriting it.
226pub(crate) fn read_checkpoint(root: &Path) -> Result<Option<ShimCheckpoint>, CheckpointError> {
227 let path = checkpoint_path(root);
228 let bytes = match fs::read(&path) {
229 Ok(bytes) => bytes,
230 Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(None),
231 Err(source) => return Err(CheckpointError::Read { path, source }),
232 };
233 decode_checkpoint_at(&bytes, path).map(Some)
234}
235
236fn decode_checkpoint_at(bytes: &[u8], path: PathBuf) -> Result<ShimCheckpoint, CheckpointError> {
237 let probe: VersionProbe =

Calls 4

checkpoint_pathFunction · 0.85
decode_checkpoint_atFunction · 0.85
readFunction · 0.50
kindMethod · 0.45

Tested by 1