Merge pull request #500 from matthiasbeyer/libimagref/delete-fix

Fix: We cannot offer a Ref::delete(self), but a Ref::delete_by_hash()
This commit is contained in:
Matthias Beyer 2016-07-05 13:48:22 +02:00 committed by GitHub
commit 64ddb501e2

View file

@ -56,12 +56,12 @@ impl<'a> Ref<'a> {
.map_err(|e| REK::StoreReadError.into_error_with_cause(e)) .map_err(|e| REK::StoreReadError.into_error_with_cause(e))
} }
/// Delete this ref /// Delete a ref by hash
/// ///
/// If the returned Result contains an error, the ref might not be deleted. /// If the returned Result contains an error, the ref might not be deleted.
pub fn delete(self, store: &'a Store) -> Result<()> { pub fn delete_by_hash(store: &'a Store, hash: String) -> Result<()> {
store store
.delete(self.0.get_location().clone()) .delete(ModuleEntryPath::new(hash).into_storeid())
.map_err(Box::new) .map_err(Box::new)
.map_err(|e| REK::StoreWriteError.into_error_with_cause(e)) .map_err(|e| REK::StoreWriteError.into_error_with_cause(e))
} }