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

Function get_file_content

atomic-cli/src/commands/git/parallel.rs:9656–9678  ·  view source on GitHub ↗
(git_repo: &GitRepository, tree: &Tree, path: &str)

Source from the content-addressed store, hash-verified

9654}
9655
9656fn 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.
9681fn parse_commit_message(message: &str) -> (String, Option<String>) {

Callers 3

parse_commit_with_scopeFunction · 0.85
parse_diff_filesFunction · 0.85

Calls 4

git_tree_entryFunction · 0.85
kindMethod · 0.45
idMethod · 0.45
contentMethod · 0.45

Tested by

no test coverage detected