Problem
Git subprocess setup is repeated across git-worktree-child-executor.ts, workspace-identity.ts, and project-catalog.ts. Each copy assembles -C, timeout, buffers, and a sanitized environment independently, while the worktree executor also maintains separate text and byte output wrappers. This is a security-sensitive boundary: an inherited GIT_DIR, GIT_WORK_TREE, or GIT_COMMON_DIR must never redirect a command away from the path being checked.
Scope
- Add a storage-local Git execution helper for text and byte output.
- Centralize removal of ambient repository-selection variables while retaining an explicit
GIT_INDEX_FILE override for patch capture.
- Migrate the three existing callers without changing their timeouts, buffer limits, arguments, or public errors.
- Add a regression test that supplies poisoned Git environment variables and verifies commands still resolve the requested repository.
Acceptance criteria
- All three callers use the same sanitized environment policy and no longer duplicate subprocess option assembly.
- Text and binary output keep their existing encodings and size limits.
- The poisoned-environment test passes on the supported host platforms.
This implements the Git execution wrapper slice identified by #1404.
Problem
Git subprocess setup is repeated across
git-worktree-child-executor.ts,workspace-identity.ts, andproject-catalog.ts. Each copy assembles-C, timeout, buffers, and a sanitized environment independently, while the worktree executor also maintains separate text and byte output wrappers. This is a security-sensitive boundary: an inheritedGIT_DIR,GIT_WORK_TREE, orGIT_COMMON_DIRmust never redirect a command away from the path being checked.Scope
GIT_INDEX_FILEoverride for patch capture.Acceptance criteria
This implements the Git execution wrapper slice identified by #1404.