Skip to content

P1: Worktree removal deletes untracked files when status.showUntrackedFiles=no #1519

Closed

Description

@currentbits

Data loss. The fast worktree-removal path checks cleanliness with plain git status --porcelain (electron/worktrees-lifecycle.js:176). That honours the user's status.showUntrackedFiles config: with no, untracked files are hidden, st.stdout is empty, and the directory is renamed to .trash-* and deleted asynchronously (:185-194). The agent's uncommitted new files are gone.

Fix (S): run the check as git -c status.showUntrackedFiles=normal status --porcelain (or --untracked-files=normal). Audit any other "is it clean?" check that gates a destructive action (cleanup, GC, merged-worktree reclaim in worktrees-gc.js) for the same pattern.

Test: a repo with git config status.showUntrackedFiles no plus one untracked file in the worktree. Removal without force must refuse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions