diff --git a/xtask/src/cts.rs b/xtask/src/cts.rs index c722a7ccbb1..6ae9346f5f8 100644 --- a/xtask/src/cts.rs +++ b/xtask/src/cts.rs @@ -161,6 +161,12 @@ fn parse_git_version_output(output: &str) -> anyhow::Result { let raw_version = raw_version.trim_end(); // There should always be a newline at the end, but // we don't care if it's missing. + // Git for Windows suffixes the version with ".windows.". + // Strip it if present. + let raw_version = raw_version + .split_once(".windows") + .map_or(raw_version, |(before, _after)| before); + let parsed = GitVersion::try_from( raw_version .splitn(3, '.') @@ -189,6 +195,7 @@ fn test_git_version_parsing() { test_ok!("git version 2.3.0", [2, 3, 0]); test_ok!("git version 0.255.0", [0, 255, 0]); test_ok!("git version 4.5.6", [4, 5, 6]); + test_ok!("git version 2.3.0.windows.1", [2, 3, 0]); macro_rules! test_err { ($input:expr, $msg:expr) => {