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 looking for an outer .git/ directory; on success append ignore_path (rendered relative to the outer root) to that repo’s .gitignore. The starting directory is the parent of the new gitdir / mem-repo so we don’t rediscover our own git.

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.