diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 48f8b834..a1be9fa4 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -19,11 +19,16 @@ pub struct StoreId(PathBuf); impl StoreId { pub fn storified(self, store: &Store) -> StoreId { - debug!("Create new store id out of: {:?} and {:?}", store.path(), self); - let mut new_id = store.path().clone(); - new_id.push(self); - debug!("Created: '{:?}'", new_id); - StoreId::from(new_id) + if self.starts_with(store.path()) { + debug!("Not storifying {:?}, because it is already.", self); + self + } else { + debug!("Create new store id out of: {:?} and {:?}", store.path(), self); + let mut new_id = store.path().clone(); + new_id.push(self); + debug!("Created: '{:?}'", new_id); + StoreId::from(new_id) + } } }