From eec9350ff8fbfd05daf16fa3a76698c1c71a14f3 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Tue, 29 Sep 2026 17:34:48 +0800 Subject: [PATCH] test(git): compare repo roots in one spelling so Windows passes (#1013) canonicalize answers \\?\C:\... on Windows while git prints C:/...; the production path already folds the first into the local spelling in probe_repo, only the test compared them raw. --- crates/tty7-core/src/core/git/head.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/tty7-core/src/core/git/head.rs b/crates/tty7-core/src/core/git/head.rs index bd2b603e..3481bffd 100644 --- a/crates/tty7-core/src/core/git/head.rs +++ b/crates/tty7-core/src/core/git/head.rs @@ -92,7 +92,7 @@ fn branch_of(head: &str) -> Option { #[cfg(test)] mod tests { use super::*; - use crate::core::git::test_support::PINS; + use crate::core::git::test_support::{PINS, one_spelling}; fn git(cwd: &Path, args: &[&str]) -> Option { let mut full = PINS.to_vec(); @@ -155,9 +155,14 @@ mod tests { assert_eq!(got.root, canon(root), "root of {}", cwd.display()); assert_eq!(got.home, canon(home), "home of {}", cwd.display()); assert_eq!(got.branch.as_deref(), Some(branch)); + // In one spelling: `canonicalize` answers `\\?\C:\…` on Windows and + // git `C:/…`. `probe_repo` folds the first into the local spelling + // before anything keys on it. assert_eq!( - got.root, - PathBuf::from(git(cwd, &["rev-parse", "--show-toplevel"]).unwrap()), + one_spelling(&got.root), + one_spelling(Path::new( + &git(cwd, &["rev-parse", "--show-toplevel"]).unwrap() + )), "and git names the same root" ); }