Skip to main content

apply_outer_gitignore

Function apply_outer_gitignore 

Source
pub fn apply_outer_gitignore(
    start: &Path,
    ignore_path: &Path,
) -> Result<OuterRepoOutcome>
Expand description

Walk upward from start (inclusive) looking for an outer .git/ directory; on success append ignore_path (rendered relative to the outer root) to that repo’s .gitignore. Callers start at the workspace root itself — the target’s own gitdir lives below it (mem-repo/.git), never on the walk path — so a workspace that IS a git-repo root still gets its append.

ignore_path must lie inside the discovered outer repo for the relative-path rendering to succeed; if strip_prefix fails the helper returns OuterRepoOutcome::NoOuter defensively rather than emit a garbled rule.

Refuses with a Validation error when the discovered outer root equals $HOME. Callers are expected to render the error verbatim or surface the --no-gitignore suggestion themselves.