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

Method insert_shared

atomic-repository/src/repository/project_tree.rs:843–852  ·  view source on GitHub ↗

[`Self::insert`] for bytes another holder already shares (a repository entry's bytes): no copy is made.

(
        &mut self,
        algorithm: GitHashAlgorithm,
        kind: GitObjectKind,
        bytes: Arc<[u8]>,
    )

Source from the content-addressed store, hash-verified

841 /// [`Self::insert`] for bytes another holder already shares (a
842 /// repository entry's bytes): no copy is made.
843 pub fn insert_shared(
844 &mut self,
845 algorithm: GitHashAlgorithm,
846 kind: GitObjectKind,
847 bytes: Arc<[u8]>,
848 ) -> Result<GitObjectId, ProjectTreeError> {
849 let oid = git_object_id(algorithm, kind, &bytes)?;
850 self.objects.insert(oid.clone(), GitObject { kind, bytes });
851 Ok(oid)
852 }
853
854 pub fn parse_manifest(
855 &self,

Callers 2

insertMethod · 0.80
write_directoryFunction · 0.80

Calls 3

git_object_idFunction · 0.70
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected