about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Pallant <jonathan.pallant@ferrous-systems.com>2024-11-25 11:26:47 +0000
committerJonathan Pallant <jonathan.pallant@ferrous-systems.com>2024-11-25 11:26:47 +0000
commit16a78526cedfdb9af5d6befce3c77436aabc9a2f (patch)
tree7f49d8b2f0a35c16d8a626d3729f14e99652c17e
parent67a8c642592f86eaf3b84030c04e0305d79953d1 (diff)
downloadrust-16a78526cedfdb9af5d6befce3c77436aabc9a2f.tar.gz
rust-16a78526cedfdb9af5d6befce3c77436aabc9a2f.zip
generate-copyright: Ensure output has UNIX line-endings for consistency.
-rw-r--r--src/tools/generate-copyright/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/generate-copyright/src/main.rs b/src/tools/generate-copyright/src/main.rs
index f9d96b59462..f83d16d0cab 100644
--- a/src/tools/generate-copyright/src/main.rs
+++ b/src/tools/generate-copyright/src/main.rs
@@ -57,6 +57,10 @@ fn main() -> Result<(), Error> {
         dependencies: collected_cargo_metadata,
     };
     let output = template.render()?;
+    // Git stores text files with \n, but this file may contain \r\n in files
+    // copied from dependencies. Normalise them before we write them out, for
+    // consistency.
+    let output = output.replace("\r\n", "\n");
     std::fs::write(&dest_file, output)?;
 
     // Output libstd subset file
@@ -65,6 +69,10 @@ fn main() -> Result<(), Error> {
         dependencies: library_collected_cargo_metadata,
     };
     let output = template.render()?;
+    // Git stores text files with \n, but this file may contain \r\n in files
+    // copied from dependencies. Normalise them before we write them out, for
+    // consistency.
+    let output = output.replace("\r\n", "\n");
     std::fs::write(&libstd_dest_file, output)?;
 
     Ok(())