(
&self,
repo: &Repository,
repo_root: &std::path::Path,
new_history: &[HistoryEntry],
latest_state: &Merkle,
view: &str,
publication: &super::s
| 485 | /// alongside them, with identity resolved through the §5.5 map. |
| 486 | #[allow(clippy::too_many_arguments)] |
| 487 | fn build_commit_message( |
| 488 | &self, |
| 489 | repo: &Repository, |
| 490 | repo_root: &std::path::Path, |
| 491 | new_history: &[HistoryEntry], |
| 492 | latest_state: &Merkle, |
| 493 | view: &str, |
| 494 | publication: &super::shadow::VerifiedPublication, |
| 495 | git_repo: &GitRepository, |
| 496 | ) -> CliResult<(String, git2::Signature<'static>)> { |
| 497 | let latest_state = latest_state.to_base32(); |
| 498 | if publication.view() != view || publication.atomic_state() != latest_state { |
| 499 | return Err(CliError::GitError { |
| 500 | message: "Atomic view/state changed after publication verification".to_string(), |
| 501 | }); |
| 502 | } |
| 503 | // Use custom message, synthesize from new change messages, or fall |
| 504 | // back to a generic label when there are no new atomic changes (e.g. |
| 505 | // manual working-copy edits). |
| 506 | let body = if let Some(ref msg) = self.message { |
| 507 | msg.clone() |
| 508 | } else if new_history.is_empty() { |
| 509 | "Working copy changes".to_string() |
| 510 | } else { |
| 511 | self.synthesize_message(new_history) |
| 512 | }; |
| 513 | |
| 514 | let mut msg = body; |
| 515 | msg.push_str("\n\n"); |
| 516 | msg.push_str(&format!("Atomic-View: {}\n", publication.view())); |
| 517 | msg.push_str(&format!("Atomic-State: {}\n", publication.atomic_state())); |
| 518 | msg.push_str(&format!( |
| 519 | "Atomic-Manifest: {}\n", |
| 520 | publication.manifest_root().content_key |
| 521 | )); |
| 522 | msg.push_str(&format!( |
| 523 | "Atomic-Policy: {}\n", |
| 524 | publication.policy_root().content_key |
| 525 | )); |
| 526 | msg.push_str(&format!( |
| 527 | "Atomic-Algorithm: {}\n", |
| 528 | match publication.object_algorithm() { |
| 529 | atomic_core::operation::GitHashAlgorithm::Sha1 => "sha1", |
| 530 | atomic_core::operation::GitHashAlgorithm::Sha256 => "sha256", |
| 531 | } |
| 532 | )); |
| 533 | msg.push_str(&format!("Atomic-Tree: {}\n", publication.git_tree_oid()?)); |
| 534 | |
| 535 | // RFC §8.2 operation-identity headers. The projection SetId comes |
| 536 | // from the canonical effective closure; the author DID from the |
| 537 | // §5.5 email mapping. |
| 538 | let set_id = repo.view_set_id(view).map_err(CliError::Repository)?; |
| 539 | let state = |
| 540 | Merkle::from_base32(latest_state.as_bytes()).ok_or_else(|| CliError::GitError { |
| 541 | message: "verified view state is not a valid Merkle value".to_string(), |
| 542 | })?; |
| 543 | msg.push_str(&format!("atomic-set {}\n", set_id.to_base32())); |
| 544 | msg.push_str(&format!("atomic-state {latest_state}\n")); |
no test coverage detected