Skip to main content

is_allowed_worktree_dir

Function is_allowed_worktree_dir 

Source
pub fn is_allowed_worktree_dir(
    candidate: &Path,
    allowed_dirs: &[PathBuf],
) -> bool
Expand description

What: Report whether the canonical candidate lies inside any allowed directory. Why: Each allowed directory is resolved through symbolic links first, so a home reached through a link still matches; a directory that does not exist drops out. Path::starts_with compares whole segments, so /a/b does not contain /a/bc.

In TS you’d write (pseudocode):

async function isAllowedWorktreeDir(candidate: string, allowedDirs: string[]): Promise<boolean>;