Add an externally loaded Git object after verifying its tagged identity.
(
&mut self,
oid: GitObjectId,
object: GitObject,
)
| 837 | |
| 838 | /// Add an externally loaded Git object after verifying its tagged identity. |
| 839 | pub fn insert_object( |
| 840 | &mut self, |
| 841 | oid: GitObjectId, |
| 842 | object: GitObject, |
| 843 | ) -> Result<(), ProjectTreeError> { |
| 844 | let computed = git_object_id(oid.algorithm(), object.kind, &object.bytes)?; |
| 845 | if computed != oid { |
| 846 | return Err(ProjectTreeError::MalformedGitTree( |
| 847 | "Git object bytes do not match the supplied object identity".into(), |
| 848 | )); |
| 849 | } |
| 850 | self.objects.insert(oid, object); |
| 851 | Ok(()) |
| 852 | } |
| 853 | |
| 854 | pub fn insert( |
| 855 | &mut self, |
nothing calls this directly
no test coverage detected