(git_repo: &GitRepository, tree: &Tree, path: &str)
| 9654 | } |
| 9655 | |
| 9656 | fn get_file_content(git_repo: &GitRepository, tree: &Tree, path: &str) -> CliResult<Vec<u8>> { |
| 9657 | // CB-9C path fidelity: the String identity is the reversible escape of |
| 9658 | // the raw Git bytes, so the tree lookup decodes before reading. |
| 9659 | let entry = git_tree_entry(git_repo, tree, path)?; |
| 9660 | |
| 9661 | if entry.kind() == Some(ObjectType::Commit) { |
| 9662 | return Ok(entry.id().to_string().into_bytes()); |
| 9663 | } |
| 9664 | |
| 9665 | if entry.kind() != Some(ObjectType::Blob) { |
| 9666 | return Err(CliError::GitError { |
| 9667 | message: "Not a file".to_string(), |
| 9668 | }); |
| 9669 | } |
| 9670 | |
| 9671 | let blob = git_repo |
| 9672 | .find_blob(entry.id()) |
| 9673 | .map_err(|e| CliError::GitError { |
| 9674 | message: format!("Failed to find blob: {}", e), |
| 9675 | })?; |
| 9676 | |
| 9677 | Ok(blob.content().to_vec()) |
| 9678 | } |
| 9679 | |
| 9680 | /// Parse a git commit message into subject and description. |
| 9681 | fn parse_commit_message(message: &str) -> (String, Option<String>) { |
no test coverage detected