Skip to main content

assert_only_allowed

Function assert_only_allowed 

Source
pub fn assert_only_allowed(
    root: &Path,
    allowed: &[PathBuf],
    globs: &[String],
    ignored: IgnoredFiles,
) -> Result<Vec<PathBuf>>
Expand description

Fail if the worktree has dirty paths outside allowed and globs.

Returns dirty paths that match globs (modified, untracked, or deleted files). Directories are skipped. Same git status walk as the unexpected-dirty check; not a filesystem glob. Renames are not tracked, so a moved file shows as its old and its new path, each of which must be allowed.

ยงErrors

Returns an error when git status cannot be computed, or when a dirty path is neither in allowed nor matched by globs. The latter error lists those paths. A root outside a repository is not an error and returns an empty list.