From 52bc81ca5b1fe78fe98b63685c0fc0a1c1c6a0ae Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:48:08 +0200 Subject: [PATCH] Launcher: the command reference is the same on Windows launcher.yml's Windows build has failed since the reference test landed: Git for Windows checks text out with CRLF (core.autocrlf), so docs/launcher-commands.md never equalled what markdown() generates. .gitattributes now pins LF for the generated files tests compare byte for byte, and the launcher's check reads the file whatever line endings a clone gave it, with a test of a CRLF checkout. Co-Authored-By: Claude Opus 5.5 --- .gitattributes | 5 +++++ launcher/src/cli_tools.rs | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..13584e4d9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Generated files that tests compare byte for byte with what they generate: LF on every OS, also +# where Git for Windows' core.autocrlf would check them out with CRLF. +docs/launcher-commands.md text eol=lf +docs/horizon-ctl-commands.md text eol=lf +website/src/tokens.css text eol=lf diff --git a/launcher/src/cli_tools.rs b/launcher/src/cli_tools.rs index 7653311ac..a851adcbd 100644 --- a/launcher/src/cli_tools.rs +++ b/launcher/src/cli_tools.rs @@ -419,6 +419,20 @@ mod tests { ); } + /// Whether the reference on disk says `want`, whatever line endings the checkout gave it: Git + /// for Windows checks text out with CRLF (core.autocrlf) where .gitattributes does not pin LF. + fn up_to_date(have: &str, want: &str) -> bool { + have.replace("\r\n", "\n") == want + } + + #[test] + fn a_windows_checkout_of_the_reference_is_up_to_date() { + let want = markdown(); + assert!(up_to_date(&want, &want)); + assert!(up_to_date(&want.replace('\n', "\r\n"), &want)); + assert!(!up_to_date(&want.replacen("## ", "### ", 1), &want)); + } + #[test] fn the_launcher_reference_is_up_to_date() { let path = @@ -429,7 +443,7 @@ mod tests { } let have = std::fs::read_to_string(&path).unwrap_or_default(); assert!( - have == want, + up_to_date(&have, &want), "docs/launcher-commands.md is out of date: HORIZON_WRITE_DOCS=1 cargo test --manifest-path launcher/Cargo.toml the_launcher_reference" ); for tool in all() {