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

Method acquire_closure

atomic-repository/src/repository/resurrection.rs:843–873  ·  view source on GitHub ↗

Complete the closure (CB-6B) and re-validate it over the local store.

(
        &self,
        git: &git2::Repository,
        binding: &GitStateBinding,
        mut remote: Option<&mut dyn crate::BindingChangeSource>,
    )

Source from the content-addressed store, hash-verified

841
842 /// Complete the closure (CB-6B) and re-validate it over the local store.
843 fn acquire_closure(
844 &self,
845 git: &git2::Repository,
846 binding: &GitStateBinding,
847 mut remote: Option<&mut dyn crate::BindingChangeSource>,
848 ) -> Result<ClosureValidation, RepositoryError> {
849 let limits = BindingPackLimits::default_limits();
850 let source: Option<&mut dyn crate::BindingChangeSource> = match remote.as_mut() {
851 Some(source) => Some(&mut **source),
852 None => None,
853 };
854 let acquisition = self.fetch_binding_closure(git, binding, source, &limits)?;
855 if let crate::ClosureReadiness::Incomplete { missing, reasons } = &acquisition.readiness {
856 return Err(RepositoryError::BindingClosureIncomplete {
857 id: binding.id().to_hex(),
858 count: missing.len(),
859 reasons: reasons
860 .iter()
861 .map(|reason| format!("{reason:?}"))
862 .collect::<Vec<_>>()
863 .join("; "),
864 });
865 }
866 let mut source = LocalClosureSource { repo: self };
867 validate_binding_closure(binding.payload(), &mut source, &limits).map_err(|error| {
868 RepositoryError::ResurrectionRejected {
869 id: binding.id().to_hex(),
870 reason: format!("closure re-validation refused: {error}"),
871 }
872 })
873 }
874
875 /// The Git lease the proof is bound to: the HEAD target at proof time.
876 fn observe_git_lease(

Callers 2

Calls 7

validate_binding_closureFunction · 0.85
fetch_binding_closureMethod · 0.80
to_hexMethod · 0.45
idMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45
payloadMethod · 0.45

Tested by

no test coverage detected