Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions xtask/src/cts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ fn parse_git_version_output(output: &str) -> anyhow::Result<GitVersion> {
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.<n>".
// 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, '.')
Expand Down Expand Up @@ -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) => {
Expand Down
Loading