Add an externally loaded Git object after verifying its tagged identity.
(
&mut self,
oid: GitObjectId,
object: GitObject,
)
| 815 | |
| 816 | /// Add an externally loaded Git object after verifying its tagged identity. |
| 817 | pub fn insert_object( |
| 818 | &mut self, |
| 819 | oid: GitObjectId, |
| 820 | object: GitObject, |
| 821 | ) -> Result<(), ProjectTreeError> { |
| 822 | let computed = git_object_id(oid.algorithm(), object.kind, &object.bytes)?; |
| 823 | if computed != oid { |
| 824 | return Err(ProjectTreeError::MalformedGitTree( |
| 825 | "Git object bytes do not match the supplied object identity".into(), |
| 826 | )); |
| 827 | } |
| 828 | self.objects.insert(oid, object); |
| 829 | Ok(()) |
| 830 | } |
| 831 | |
| 832 | pub fn insert( |
| 833 | &mut self, |
nothing calls this directly
no test coverage detected