Ensure that StoreId::storified() does not alter already storified StoreId objects
This commit is contained in:
parent
a706680fd5
commit
9605d6daa6
1 changed files with 10 additions and 5 deletions
|
@ -19,11 +19,16 @@ pub struct StoreId(PathBuf);
|
||||||
impl StoreId {
|
impl StoreId {
|
||||||
|
|
||||||
pub fn storified(self, store: &Store) -> StoreId {
|
pub fn storified(self, store: &Store) -> StoreId {
|
||||||
debug!("Create new store id out of: {:?} and {:?}", store.path(), self);
|
if self.starts_with(store.path()) {
|
||||||
let mut new_id = store.path().clone();
|
debug!("Not storifying {:?}, because it is already.", self);
|
||||||
new_id.push(self);
|
self
|
||||||
debug!("Created: '{:?}'", new_id);
|
} else {
|
||||||
StoreId::from(new_id)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue