summaryrefslogtreecommitdiffstats
path: root/lib/core
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-11-06 18:18:23 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-11-06 18:34:33 +0100
commitbecfcd41807bf65fb6f8543800bb57d7e8e93d7a (patch)
tree289ad5a7cb1799c1a5b7a3e320b0f8b748a373f3 /lib/core
parentdaaa4fd9cac860f74f0a6637aa6fd92b24851995 (diff)
Fix: In-Memory test backend: Actually remove the old entry on "move"
This fixes a really ugly bug where the in-memory backend for the store did not remove the entry from the in-memory hashmap on "move", but simply copied it from the old location to the new one. That caused tests to fail after the fixes introduced for the Store::get() function which checked the filesystem and the internal cache whether an entry exists before the actual "get" operation, because an old entry would still exist after a move (only in the testcases). Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Fixes: 09e8619cf5 ("libimagstore: Move from error-chain to failure")
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/libimagstore/src/file_abstraction/inmemory.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/core/libimagstore/src/file_abstraction/inmemory.rs b/lib/core/libimagstore/src/file_abstraction/inmemory.rs
index a499b697..d5e89ac7 100644
--- a/lib/core/libimagstore/src/file_abstraction/inmemory.rs
+++ b/lib/core/libimagstore/src/file_abstraction/inmemory.rs
@@ -140,7 +140,7 @@ impl FileAbstraction for InMemoryFileAbstraction {
let mut mtx = self.backend().lock().expect("Locking Mutex failed");
let backend = mtx.get_mut();
- let a = backend.get(from).cloned().ok_or_else(|| EM::FileNotFound)?;
+ let a = backend.remove(from).ok_or_else(|| EM::FileNotFound)?;
backend.insert(to.clone(), a);
debug!("Renaming: {:?} -> {:?} worked", from, to);
Ok(())