Skip to content

Never let status.showUntrackedFiles=no hide work from worktree removal (#1519) - #1546

Merged
currentbits merged 3 commits into
mainfrom
coder/1519-worktree-removal-data-loss-18577d
Oct 11, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/1519-worktree-removal-data-loss-18577d

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #1519. P1 data loss.

When status.showUntrackedFiles=no is set, git hides untracked files from both its own cleanliness check and plain git status --porcelain. A worktree holding an agent's uncommitted new files then read as clean, and removal deleted it.

Changes

  • electron/worktrees-lifecycle.js removeWorktreeDir: the fast-path check runs status --porcelain --untracked-files=normal --ignore-submodules=none, and the fallback git worktree remove gets -c status.showUntrackedFiles=normal. Worktrees that contain submodules go to git, which refuses to remove them.
  • electron/worktrees-gc.js: the same -c override on merged-worktree reclaim, the orphan sweep and GC removal.
  • electron/mergeQueue.js previewLane: the dirty check on the main checkout now counts untracked files.

Tests: a repo with showUntrackedFiles=no and one untracked file. Removal without force now refuses, and so does the merge-queue preview. The full electron suite passes: 4351 pass, 0 fail.

Part of the #1532 gap pass.

🤖 Generated with Claude Code

… removal (#1519)

The fast removeWorktreeDir path and git's own non-force `worktree remove`
both honour status.showUntrackedFiles=no, so an untracked file read as clean
and was deleted. Force untracked=normal (and ignore-submodules=none) on the
fast-path check, pass -c status.showUntrackedFiles=normal to every non-force
`worktree remove` (fallback, merged reclaim, orphan sweep, GC), and fix the
same blind spot in the merge-queue lane preview gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T12:47:41.575590Z 2d6e02e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits merged commit e3a6798 into main Oct 11, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant