diff --git a/src/scripts/link.rs b/src/scripts/link.rs index dad1596..90c780f 100644 --- a/src/scripts/link.rs +++ b/src/scripts/link.rs @@ -99,7 +99,7 @@ fn restore_one(repo: &Repo, path: &Path, report: &Report) -> Result<()> { fs::remove_file(&src).with_context(|| format!("removing {}", src.display()))?; move_path(&stored, &src)?; - prune_empty(stored.parent(), &store_root()?); + prune_empty(stored.parent(), &repo.base); report.line("restored", &rel); Ok(()) @@ -425,22 +425,24 @@ fn list_others(repo: &Repo, ignored: bool, pathspecs: &[PathBuf]) -> Result) -> Result { let root = git_root()?; - let store = match store { + let base = match store { Some(store) => store.to_path_buf(), None => store_root()?, }; Ok(Self { - root: root.clone(), - store: store.join(repo_components(&root)?), + store: base.join(repo_components(&root)?), + root, + base, }) } - fn relative(&self, src: &Path) -> Result { let rel = src.strip_prefix(&self.root).map_err(|_| { anyhow!(