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 {
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue