pub fn exclude_from_git(
worktree_root: &Path,
filename: &str,
) -> Result<(), PawError>Expand description
Excludes a file from git tracking by adding it to info/exclude.
This prevents the file from being tracked by git without modifying the
repository’s .gitignore file, which is useful for worktree-specific
files that should not be committed. Idempotent: an entry already present is
not duplicated.
Linked worktrees. Git reads info/exclude from the common git
directory, never the per-worktree git directory, so for a linked worktree
(<worktree>/.git is a file pointing at <common>/worktrees/<id>) the
entry is written to the common dir’s info/exclude. Writing it to the
per-worktree dir — as an earlier version did — has no effect: git silently
ignores it, so the path would remain stageable.