Repository navigation
fix(git): remove worktree folders Finder leaves behind after removal - #685
Conversation
Recover only when Git deleted the checkout .git file and canonical NUL-separated inventory confirms it is unregistered. Share the regular-file Finder metadata rule with storage cleanup, preserve all other new work, and fail closed for refused or unprovable removal. Carry-Group: incubator Carry-Fix: #676 Carry-Observation: Extends leftover removal and Finder metadata cleanup carried in later groups; replay requires incubator.
f38bb2e to
098f457
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Final local validation on All 50 focused worktree/Finder cases and exact-head Quick CI also passed. Codex review completed cleanly on this head, with zero unresolved review threads. The final selected-test run mentioned as pending in the description is now complete. The unused-patch check was skipped because no dependency files changed. #677 is untouched. |
Problem
On macOS, Finder can recreate a
.DS_Storefile inside a worktree folder while Git is removing it. Git then unregisters the worktree but can't delete the folder, because it isn't empty. The result is an orphaned folder that later storage cleanup keeps.Refs #676. This stops one source of new orphaned folders. Classifying orphans that already exist is still tracked in that issue, so this PR doesn't close it.
Fix
Worktree removal now finishes the job when only Finder metadata is left.
git worktree removefails after deleting the folder's.gitfile, we list worktrees and compare canonical paths. The leftover cleanup runs only when the folder is no longer registered. Recovery requires NUL-separated output; Git versions that don't support it keep the original failure..DS_Storerule: a newisDisposableFinderMetadatahelper treats a.DS_Storeas disposable only if it is a regular file. Directories with that name are kept without traversing their contents. Existing link cleanup still unlinks links without following them. Storage cleanup's "has ignored files" check now uses the same helper instead of its own copy..DS_Storefiles, and removes directories left empty..gitintact does not trigger cleanup, including foreign or already-pruned worktrees. If the worktree list can't be read or comes back empty or truncated, we keep the original removal failure and leave the folder.Proof
check:changed: format, lint, graphql, knip, and typecheck of the three affected packages passed. The final selected-test run is still running; the previous run passed all 679 tests.No manifest changed; the unused-patch check is skipped and #677 is untouched.
The commit uses
Carry-Group: incubatorbecause it extends cleanup already carried in later groups. Same-base compilation passed with that assignment;upstream-bugfixesconflicts before those dependencies are replayed.Local review: 3 rounds with gpt-6.1-terra (xhigh) and claude-opus-5-5 (high), approved. Concrete findings were addressed. The remaining hypothetical malformed-successful-Git-output concern was declined: output reads and process completion are awaited, read errors fail, and truncation is rejected.
Implemented with GPT-6.1 Sol (xhigh), Codex harness in T3 Code.