Fix blank git diff view on Windows when working in a subfolder#52234
Fix blank git diff view on Windows when working in a subfolder#52234reflectronic merged 3 commits intozed-industries:mainfrom
Conversation
|
Thanks @HiteshRohira! This change makes sense in the abstract, but I'd like to understand how it fixes the issue you're seeing. Are you seeing that we're not successfully doing Also cc @reflectronic who is more knowledgeable about Windows paths than I am. |
1b799b1 to
3a5dc8e
Compare
|
This is what the differences in paths were looking like. This comes from logs in the @cole-miller thank you for the pushback on this, the bug ended up being in a different place. When zed was joining paths in When that path went into I have fixed |
|
can we know the status of this PR |
|
@devoper2022 just waiting for approval |
|
@Anthony-Eid can you review this PR |
Context
Fixes a Windows path handling bug in
crates/util/src/paths.rswhen computing a relative path viastrip_prefix. (Closes #51758 )Previously, Windows prefix matching only handled drive-letter case-insensitivity. It could still fail when the parent and child paths referred to the same location but used different separator styles (
\vs/) or different casing in later path segments. That caused valid Windows paths to returnNoneinstead of a relative path, which caused the diff to break.This change normalizes Windows paths for prefix comparison by lowercasing any ASCII characters and converting backslashes to forward slashes before checking the prefix.
Tests were added for mixed-case and mixed-separator Windows paths to cover the bug and prevent further regressions.
How to Review
strip_prefixWindows branch to confirm the new normalization logic only affects prefix comparison and still rejects partial-segment matches.Self-Review Checklist
Release Notes: