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

Function tree_with_file

atomic-repository/src/repository/projection_commit.rs:692–698  ·  view source on GitHub ↗
(git: &git2::Repository, name: &str, bytes: &[u8])

Source from the content-addressed store, hash-verified

690 }
691
692 fn tree_with_file(git: &git2::Repository, name: &str, bytes: &[u8]) -> GitObjectId {
693 let blob = git.blob(bytes).expect("blob");
694 let mut builder = git.treebuilder(None).expect("treebuilder");
695 builder.insert(name, blob, 0o100644).expect("insert entry");
696 let oid = builder.write().expect("tree");
697 GitObjectId::new(GitHashAlgorithm::Sha1, oid.as_bytes().to_vec()).unwrap()
698 }
699
700 fn parent_commit(git: &git2::Repository, tree: &GitObjectId) -> GitObjectId {
701 let tree = git

Calls 4

insertMethod · 0.45
writeMethod · 0.45
unwrapMethod · 0.45
as_bytesMethod · 0.45