fix: follow a link anywhere under the store base

This commit is contained in:
2026-09-21 13:04:36 +00:00
parent c96211a28b
commit 22d735d52c
4 changed files with 46 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use anyhow::{Result, anyhow};
use super::store::{Leads, Repo, leads, resolve, symlink_metadata_opt};
use super::store::{Leads, Repo, held, leads, resolve, symlink_metadata_opt};
use crate::cli::link as cli;
use crate::cmd::{Cmd, LsFiles};
use crate::ctx::Ctx;
@@ -179,10 +179,10 @@ fn classify(repo: &Repo, rel: &Path, mark: char) -> Result<Option<Exposed>> {
}
let dest = read_link(&src)?;
if dest == repo.store.join(rel) {
if held(repo, &src, &dest).is_some() {
// it names the store, but what the store holds there can be a symlink of
// its own leading straight back out, which is not being held at all
return Ok(match leads(&src, &repo.store) {
return Ok(match leads(&src, &repo.base) {
Leads::Inside | Leads::Dangling => None,
Leads::Outside(end) => Some(Exposed {
mark,