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

Method validate_working_copy

atomic-repository/src/repository/working_copy.rs:726–741  ·  view source on GitHub ↗

Verify that an ID, its record, and this canonical location all agree.

(&self, id: WorkingCopyId)

Source from the content-addressed store, hash-verified

724
725 /// Verify that an ID, its record, and this canonical location all agree.
726 pub fn validate_working_copy(&self, id: WorkingCopyId) -> Result<(), RepositoryError> {
727 // One layout for all three checks: they describe the same moment.
728 let layout = self.handle_layout()?;
729 let actual = self.working_copy_id_in(&layout)?;
730 if actual != id {
731 return Err(RepositoryError::WorkingCopyIdentityMismatch {
732 requested: id,
733 actual,
734 });
735 }
736 let record = self.working_copy_record_in(&layout, id)?;
737 if record.location_fingerprint != layout.location_fingerprint {
738 return Err(RepositoryError::WorkingCopyLocationMismatch { id });
739 }
740 Ok(())
741 }
742
743 /// Resolve the authoritative desired view for a validated working copy.
744 pub fn desired_view_name(&self, id: WorkingCopyId) -> Result<String, RepositoryError> {

Calls 3

handle_layoutMethod · 0.80
working_copy_id_inMethod · 0.80