| 8601 | } |
| 8602 | |
| 8603 | fn parse_commit_with_scope( |
| 8604 | git_repo: &GitRepository, |
| 8605 | oid: Oid, |
| 8606 | _index: usize, |
| 8607 | oid_to_index: &std::collections::HashMap<Oid, usize>, |
| 8608 | include_merge_union: bool, |
| 8609 | ) -> CliResult<ParsedCommit> { |
| 8610 | let parse_start = Instant::now(); |
| 8611 | let commit = git_repo.find_commit(oid).map_err(|e| CliError::GitError { |
| 8612 | message: format!("Failed to find commit {}: {}", oid, e), |
| 8613 | })?; |
| 8614 | |
| 8615 | let sha = oid.to_string(); |
| 8616 | let short_sha = sha[..8.min(sha.len())].to_string(); |
| 8617 | |
| 8618 | // Capture the complete raw signed commit object bytes (review blocker |
| 8619 | // 6): the hashed fact records retain them so the exact signed object |
| 8620 | // can be recovered and re-verified without the source Git ODB. |
| 8621 | let raw_object = { |
| 8622 | let odb = git_repo.odb().map_err(|e| CliError::GitError { |
| 8623 | message: format!("Failed to open ODB for {}: {}", oid, e), |
| 8624 | })?; |
| 8625 | let object = odb.read(oid).map_err(|e| CliError::GitError { |
| 8626 | message: format!("Failed to read raw commit object {}: {}", oid, e), |
| 8627 | })?; |
| 8628 | object.data().to_vec() |
| 8629 | }; |
| 8630 | |
| 8631 | // Extract metadata |
| 8632 | let metadata = extract_commit_metadata(&commit)?; |
| 8633 | |
| 8634 | // Get parent index |
| 8635 | let parent_index = if commit.parent_count() > 0 { |
| 8636 | commit |
| 8637 | .parent_id(0) |
| 8638 | .ok() |
| 8639 | .and_then(|parent_oid| oid_to_index.get(&parent_oid).copied()) |
| 8640 | } else { |
| 8641 | None |
| 8642 | }; |
| 8643 | |
| 8644 | let is_merge = commit.parent_count() > 1; |
| 8645 | |
| 8646 | // Get trees for diff |
| 8647 | let tree = commit.tree().map_err(|e| CliError::GitError { |
| 8648 | message: format!("Failed to get tree: {}", e), |
| 8649 | })?; |
| 8650 | |
| 8651 | let parent_tree = if commit.parent_count() > 0 { |
| 8652 | Some( |
| 8653 | commit |
| 8654 | .parent(0) |
| 8655 | .map_err(|e| CliError::GitError { |
| 8656 | message: format!("Failed to get parent: {}", e), |
| 8657 | })? |
| 8658 | .tree() |
| 8659 | .map_err(|e| CliError::GitError { |
| 8660 | message: format!("Failed to get parent tree: {}", e), |