docs(scm): name what actually splits the two spellings of a repo root

The three gates left on for Windows all blamed the slash direction: git
for Windows is MSYS2 and prints `C:/Users/...`, the OS spells it
`C:\Users\...`. That reading is wrong, and #796 pinned why — `Path`
compares by component, so `C:/x` and `C:\x` are already equal. What the
tests actually hold is `fs::canonicalize`'s answer, `\?\C:\Users\...`,
whose prefix component is `VerbatimDisk` where git's parses as `Disk`.

Comment-only. The gates stay exactly where they are; only the reason
written at each of them changes, so that whoever lifts them after #796
lands is not chasing slashes.
This commit is contained in:
l0ng-ai
2026-09-07 22:19:19 +08:00
parent e94ea46147
commit 44920109f2
3 changed files with 27 additions and 18 deletions
+11 -7
View File
@@ -2470,13 +2470,17 @@ mod overlay_gpui_tests {
/// the repository has left. That is what the stale entry below stands for.
///
/// Unix-only, and not for the harness: on Windows the repository root git
/// reports (`C:/Users/—`, forward slashes, straight out of MSYS2 git) is
/// not the root the seeded cache below holds, so `scm_epoch` never agrees
/// with the landing snapshot and the overlay re-probes on every frame —
/// `load` reaches `Ready` and `loading` goes straight back to `true`,
/// which is the exact spin this test exists to catch. That is a real
/// divergence in the SCM layer's path comparisons rather than a test
/// artefact, so the gate stays until those roots are compared normalised.
/// reports (`C:/Users/—`, straight out of MSYS2 git) is not the root the
/// seeded cache below holds. Not for the slash direction — `Path` compares
/// by component, so `C:/x` and `C:\x` are already equal. The splitter is
/// the prefix: the seeded root came past `fs::canonicalize`, which spells
/// it `\\?\C:\Users\—` and makes its prefix component `VerbatimDisk` where
/// git's answer parses as `Disk`. So `scm_epoch` never agrees with the
/// landing snapshot and the overlay re-probes on every frame — `load`
/// reaches `Ready` and `loading` goes straight back to `true`, which is the
/// exact spin this test exists to catch. That is a real divergence in the
/// SCM layer's path comparisons rather than a test artefact, so the gate
/// stays until those roots are keyed by one spelling (#796).
#[cfg(all(test, unix))]
mod render_idle_gpui_tests {
use super::*;
+9 -7
View File
@@ -977,13 +977,15 @@ mod tests {
///
/// Still unix-only, and for a reason worth naming rather than a harness
/// one: on Windows `git rev-parse --show-toplevel` (Git for Windows is
/// MSYS2) prints `C:/Users/—` with forward slashes, and that string is
/// what `tty7_core::core::git::probe` stores as `RepoSnapshot::root`.
/// Every comparison here — and in the SCM cache — is a plain `PathBuf`
/// equality against a path the OS spelled `C:\Users\`, so the two never
/// match and the panel never settles on the directory it is already
/// showing. Taking the gate off needs those roots compared normalised,
/// the way `ui::path_display` already normalises for display.
/// MSYS2) prints `C:/Users/—`, and that string is what
/// `tty7_core::core::git::probe` stores as `RepoSnapshot::root`. The
/// forward slashes are not what breaks it — `Path` compares by component,
/// so `C:/x` and `C:\x` are equal. The prefix is: `scratch` below hands the
/// pane `fs::canonicalize`'s `\\?\C:\Users\—`, whose prefix component is
/// `VerbatimDisk` where git's answer parses as `Disk`, so the plain
/// `PathBuf` equalities here — and in the SCM cache — never match and the
/// panel never settles on the directory it is already showing. Taking the
/// gate off needs those roots keyed by one spelling (#796).
#[cfg(all(test, unix))]
mod detail_gpui_tests {
use super::*;
+7 -4
View File
@@ -2975,10 +2975,13 @@ mod render_idle_gpui_tests {
}
/// The only test in this module that waits on `repo.root`, and so the
/// only one Windows cannot run: git spells that root `C:/Users/—` and
/// the pane's own cwd is spelled `C:\Users\`, so the equality below
/// never holds there. Its sibling keys off the pane's cwd instead, and
/// runs everywhere.
/// only one Windows cannot run: git spells that root `C:/Users/—`, which
/// parses to a `Disk` prefix, while the pane's cwd came out of `scratch`
/// above — `fs::canonicalize`, so `\\?\C:\Users\—` and a `VerbatimDisk`
/// prefix — and the equality below never holds between the two. The
/// slashes are the red herring here; `Path` compares by component, so
/// `C:/x` and `C:\x` are equal. Its sibling keys off the pane's cwd
/// instead, and runs everywhere.
#[cfg(unix)]
#[gpui::test]
fn a_settled_source_control_panel_reaches_render_idle(cx: &mut TestAppContext) {