Closed
Description
Context
PR basefoundry/base#2621 fixed a stale linked-worktree failure in Base by validating the path before dirty checks and removal. Its review identified several related Git validity probes across this library and Base, but their contracts are not identical.
Goal
Define and test a reusable base-bash-libs contract for validating Git worktree paths, then migrate only equivalent consumers. The helper must make the distinction between a valid linked worktree, an ordinary repository checkout, a detached worktree, and stale or prunable worktree metadata explicit.
Proposed scope
- Design the helper API and return/status contract in base-bash-libs.
- Keep stale or prunable metadata observable without raw Git fatal output.
- Add focused tests for missing paths, invalid linked-worktree metadata, valid linked worktrees, ordinary clones, detached worktrees, and paths containing spaces.
- Identify and migrate only call sites whose current behavior is equivalent.
- Release the library, then update Base to consume the released helper and remove its local duplicate where appropriate.
- Document the contract and migration boundary.
Non-goals
- No change to the already-merged Base fix in #2621.
- No automatic deletion of orphan directories or broad worktree cleanup redesign.
- Do not force unrelated
git rev-parsechecks through one helper when their contracts differ.
Acceptance criteria
- The helper contract is documented and covered by focused base-bash-libs tests.
- Stale worktree metadata is reported safely and does not cause raw
git -Cfailures at migrated call sites. - Ordinary repositories and detached worktrees retain their intended behavior.
- Base migration is made in a follow-up PR only after a released base-bash-libs version is available.
Related: basefoundry/base#2621
Demo Impact: None.
AI context: unchanged; this is a reusable Git-library maintainability improvement.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or product improvement
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsDone
Activity