✅ 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.
This commit is contained in:
Anees Iqbal committed 2026-11-27 11:30:01 -08:00
1 parent 6a1d3d77a5
commit 24c281a610
1 file changed
+25
+25
View File
@@ -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]