Expand description
Shared helper: detect the enclosing git repo and append a path to
its .gitignore.
Used by both memstead mem init (legacy disk-mem bootstrap) and
memstead mem-repo init (post-cutover mem-repo-git bootstrap). The two
commands differ in what path they ignore (mem root vs. the
mem-repo/ directory) but share every other rule:
- Walk upward from a starting directory looking for
.git/. - Refuse to modify a
.gitignorewhose owning repo is$HOME— silent edits to dotfile repos are a recognized footgun. - Stop the walk at filesystem root and at mount-boundary crossings
(the latter via
metadata().dev()on unix; disabled elsewhere). - Append idempotently — if the ignore line is already present (modulo leading/trailing slash), no change is made.
Public surface: apply_outer_gitignore takes the start directory
plus the path to ignore (which must be inside the outer repo for the
relative computation to succeed); returns an OuterRepoOutcome
the caller renders into a user-facing message.
Enums§
- Outer
Repo Outcome - Outcome of the outer-repo
.gitignorehandling step.
Functions§
- apply_
outer_ gitignore - Walk upward from
startlooking for an outer.git/directory; on success appendignore_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.