diff options
Diffstat (limited to 'ripple/fossil/src')
-rw-r--r-- | ripple/fossil/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ripple/fossil/src/lib.rs b/ripple/fossil/src/lib.rs index b51fc27..3b2b3f8 100644 --- a/ripple/fossil/src/lib.rs +++ b/ripple/fossil/src/lib.rs @@ -116,11 +116,14 @@ impl Store { encoder.finalize().unwrap() }; - if self.blobs.contains_key(&*ident.as_bytes()).unwrap() { - // key already exists - return ident; + if !self.blobs.contains_key(&*ident.as_bytes()).unwrap() { + self.write_blob_inner(&ident, outboard, data); } + ident + } + + fn write_blob_inner(&self, ident: &Digest, outboard: Vec<u8>, data: &[u8]) { let mut chunks_file = self.chunks.borrow_mut(); let offset = self.chunks_tail.get(); @@ -149,8 +152,6 @@ impl Store { }) .unwrap(); self.chunks_tail.set(chunks_tail); - - ident.into() } pub fn read_blob(&self, ident: Digest) -> Vec<u8> { |