Skip to content

Commit 16a7852

Browse files
generate-copyright: Ensure output has UNIX line-endings for consistency.
1 parent 67a8c64 commit 16a7852

File tree

1 file changed

+8
-0
lines changed
  • src/tools/generate-copyright/src

1 file changed

+8
-0
lines changed

src/tools/generate-copyright/src/main.rs

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ fn main() -> Result<(), Error> {
5757
dependencies: collected_cargo_metadata,
5858
};
5959
let output = template.render()?;
60+
// Git stores text files with \n, but this file may contain \r\n in files
61+
// copied from dependencies. Normalise them before we write them out, for
62+
// consistency.
63+
let output = output.replace("\r\n", "\n");
6064
std::fs::write(&dest_file, output)?;
6165

6266
// Output libstd subset file
@@ -65,6 +69,10 @@ fn main() -> Result<(), Error> {
6569
dependencies: library_collected_cargo_metadata,
6670
};
6771
let output = template.render()?;
72+
// Git stores text files with \n, but this file may contain \r\n in files
73+
// copied from dependencies. Normalise them before we write them out, for
74+
// consistency.
75+
let output = output.replace("\r\n", "\n");
6876
std::fs::write(&libstd_dest_file, output)?;
6977

7078
Ok(())

0 commit comments

Comments
 (0)