Repository navigation
fix(git): preserve POSIX filenames during bulk discard - #27134
BichengWang wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal CI checks; no actionable risk was identified in the supplied evidence. Pre-merge checks |
|
|
Follow-up check: this PR now conflicts with main. The legacy relay implementation and its test harness have been removed upstream; the current execution-host runtime path also normalizes POSIX backslashes before discard. I am preparing a replacement against current main for #27133, with real-Git regression coverage through the native and current runtime entry points. I will link the replacement here once verified. |
|
Superseded by #27757, which ports the fix to current main and also preserves POSIX filenames in the current execution-host runtime validator. Seven real-Git regressions fail before and pass afterward; 128 focused tests, full lint, full typecheck, the execution-host build, and a standalone native/runtime smoke pass. Closing this conflicting legacy-relay version to keep review in one place. |
ELI5
On macOS and Linux,
docs\file.txtanddocs/file.txtare different files. Discarding a selection containing both now restores the tracked file and removes the selected untracked file instead of failing with a Git path error.What Changed
The shared tracked-path comparison keeps backslashes literal on POSIX execution hosts. It retains separator normalization on Windows and for the existing WSL input conversion. Native and relay bulk discard use the same matcher.
Why
Correcting the existing matcher makes the tracked/untracked decision agree with the filenames Git receives. Separate platform-specific discard implementations would duplicate the restore, clean, and safety logic; this approach also retains the existing lazy comparison cache.
Linked Issue
Fixes #27133
Visual Proof
N/A — backend filename comparison only; no UI components, layout, or interaction flows are changed. The real-Git regression cases demonstrate the behavior before and after:
Testing
Tested on macOS with Node 24.19.0, Bun 1.4.2, and real Git 2.54.0. All six new cases fail against unmodified upstream and pass with this patch; 121 tests across 12 discard, staging, path-safety, pathspec, and relay suites pass. Reproduce the new coverage with:
pnpm test src/main/git/source-control/discard-backslash-paths.test.tspnpm lint,pnpm tc, the changed-code quality gate, formatting,build:relay, andbuild:electron-vitepass. Full-suite and packaging checks remain for CI. No manual GUI check or live Linux, Windows, WSL, or SSH session was run; Windows comparison and WSL conversion have automated coverage.Review
Reviewed execution-host path semantics, native/relay consistency, staged-content preservation, unselected-file and symlink safety, and comparison cost. Git options and remote messages are unchanged. The fix applies to repository-backed folder workspaces as well as Git worktrees and adds no provider or integration assumptions.
Skill upstream boundary
Notes
No UI, mobile, keyboard-shortcut, or integration code changes.
Author
GitHub: @BichengWang. X handle not provided.
Checklist
N/Awith reason