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

Method write_commit_synthesized

atomic-cli/src/commands/git/parallel.rs:5931–6978  ·  view source on GitHub ↗
(
        &self,
        repo: &mut Repository,
        git: &GitRepository,
        ledger: &mut ClosureLedger,
        parsed: &ParsedCommit,
        verified: &VerifiedProspectiveEquivalence,
     

Source from the content-addressed store, hash-verified

5929 #[allow(clippy::too_many_arguments)]
5930 #[allow(clippy::too_many_arguments)]
5931 fn write_commit_synthesized(
5932 &self,
5933 repo: &mut Repository,
5934 git: &GitRepository,
5935 ledger: &mut ClosureLedger,
5936 parsed: &ParsedCommit,
5937 verified: &VerifiedProspectiveEquivalence,
5938 prospective: &atomic_repository::ProjectTree,
5939 boundaries: &[&'static str],
5940 touched_only: bool,
5941 ) -> CliResult<ImportedCommitInfo> {
5942 use atomic_core::output::memory::Memory;
5943 use atomic_core::record::workflow::{
5944 record_added_file, record_modified_file, DetectedFile, RecordingOptions,
5945 };
5946
5947 let working_copy = repo
5948 .require_working_copy_id()
5949 .map_err(|e| CliError::Internal(e.into()))?;
5950 let commit_start = std::time::Instant::now();
5951 let target = self.options.target_view.clone();
5952
5953 // Build change header
5954 let mut header_builder = ChangeHeader::builder()
5955 .message(&parsed.metadata.message)
5956 .author(Author::new(
5957 &parsed.metadata.author_name,
5958 parsed.metadata.author_email.as_deref(),
5959 ))
5960 .timestamp(parsed.metadata.timestamp);
5961 if let Some(ref desc) = parsed.metadata.description {
5962 header_builder = header_builder.description(desc);
5963 }
5964 let header = header_builder.build();
5965
5966 // Hashed origin facts: tagged commit/tree OIDs, complete ordered
5967 // parents, derivation. Git parents are ancestry evidence only.
5968 // CB-9B: a squash-shaped unbound commit (squash-merge message format,
5969 // no Atomic trailers) synthesizes one `Derivation::Squash`
5970 // interpretation instead of FirstParent.
5971 let algorithm = git_algorithm_for_sha(&parsed.git_sha)?;
5972 let squash_shaped = parse_squash_merge_format(&parsed.full_message()).is_some();
5973 let origin = if parsed.parent_oids.is_empty() {
5974 GitSynthesisOrigin::with_derivation(
5975 git_object_id_for_sha(algorithm, &parsed.git_sha)?,
5976 git_object_id(algorithm, parsed.tree_oid)?,
5977 Vec::new(),
5978 if squash_shaped {
5979 GitDerivation::Squash
5980 } else {
5981 GitDerivation::Root
5982 },
5983 )
5984 } else {
5985 if parsed.parent_oids.len() > 1 && !self.options.mainline_only {
5986 return Err(git_error(format!(
5987 "commit {} has {} parents; multi-parent commits take the GitResolution \
5988 path, not single-commit synthesis",

Callers 1

write_commitMethod · 0.80

Calls 15

git_algorithm_for_shaFunction · 0.85
git_object_id_for_shaFunction · 0.85
repository_pathFunction · 0.85
expected_materializationFunction · 0.85
ModeEnum · 0.85
KindEnum · 0.85
trace_git_importFunction · 0.85
sits_under_deleted_pathFunction · 0.85
addedFunction · 0.85
record_added_fileFunction · 0.85
similarity_bpsFunction · 0.85

Tested by

no test coverage detected