From 24c281a610ad1272ac60516c0dfe6a0ee5f4a2e8 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 27 Nov 2026 11:26:53 -0800 Subject: [PATCH] :white_check_mark: Test that checkouts keep LF whatever autocrlf says A user's install of the development channel on Windows stopped in cargo xtask dist: Git for Windows' installer sets core.autocrlf=true, the clone held CRLF .metal sources, and reims-vgpu-vulkan's build script found the committed metallibs built from other bytes. 5fdd3c05f's .gitattributes (* text=auto eol=lf) keeps LF in every checkout, but nothing checked that the attribute holds for the files read byte for byte. xtask's new test asks git check-attr for text and eol of a .metal source, the C header and a guest Info.plist, and wants auto and lf for each. With the attribute line taken out it fails: eol is unspecified. --- xtask/src/main.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 4a98fd7a6..896d0e455 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -445,6 +445,31 @@ mod tests { } } + /// Text is checked out with LF line ends whatever core.autocrlf says (5fdd3c05f): Git for + /// Windows' installer sets it true, and a user's install then stopped in `cargo xtask dist`, + /// where reims-vgpu-vulkan's build script hashed CRLF .metal sources against the committed + /// metallibs. Asked of git for files the build and its checks read byte for byte. + #[test] + fn text_is_checked_out_with_lf_whatever_autocrlf_says() { + let files = [ + "crates/reims-vgpu-vulkan/src/gpu/shaders.metal", + "crates/reims-vgpu-c/include/reims_vgpu.h", + "guest/prebuilt/ReimsGraphics.kext/Contents/Info.plist", + ]; + let out = std::process::Command::new("git") + .args(["check-attr", "text", "eol", "--"]) + .args(files) + .current_dir(repo_root()) + .output() + .expect("git check-attr"); + assert!(out.status.success(), "{out:?}"); + let said: String = files + .iter() + .map(|f| format!("{f}: text: auto\n{f}: eol: lf\n")) + .collect(); + assert_eq!(String::from_utf8_lossy(&out.stdout), said); + } + /// Each test binary's `../lib`, once a directory: under Cargo's build-dir layout each binary /// has a directory of its own, and before it they share `deps`. #[test]