fix: follow a link anywhere under the store base
This commit is contained in:
@@ -289,6 +289,19 @@ pub(super) fn symlink_metadata_opt(path: &Path) -> Result<Option<std::fs::Metada
|
||||
}
|
||||
}
|
||||
|
||||
// where a link into the store points, if it is one: absolute, under the base.
|
||||
// the directory need not be this checkout's own, since a moved checkout or an
|
||||
// older layout still holds the file
|
||||
pub(super) fn held(repo: &Repo, link: &Path, dest: &Path) -> Option<PathBuf> {
|
||||
let dest = match dest.is_absolute() {
|
||||
true => dest.to_path_buf(),
|
||||
false => link.parent()?.join(dest),
|
||||
};
|
||||
let dest = normalized(dest).ok()?;
|
||||
|
||||
dest.starts_with(&repo.base).then_some(dest)
|
||||
}
|
||||
|
||||
// where a chain of symlinks actually ends up
|
||||
pub(super) enum Leads {
|
||||
// somewhere under the directory it was supposed to stay in
|
||||
|
||||
Reference in New Issue
Block a user