@@ -777,7 +777,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
777
777
778
778
def compare (file : File , expected : String ): Unit = {
779
779
val actual = IO .read(file)
780
- if (expected != actual) {
780
+ if (removeWindowsLineEndings( expected) != removeWindowsLineEndings( actual) ) {
781
781
reportMismatch(file, expected, actual)
782
782
}
783
783
}
@@ -789,8 +789,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
789
789
})
790
790
791
791
private [sbtghactions] def diff (expected : String , actual : String ): String = {
792
- val expectedLines = expected.split(" \n " , - 1 )
793
- val actualLines = actual.split(" \n " , - 1 )
792
+ val expectedLines = removeWindowsLineEndings( expected) .split(" \n " , - 1 )
793
+ val actualLines = removeWindowsLineEndings( actual) .split(" \n " , - 1 )
794
794
val (lines, _) = expectedLines.zipAll(actualLines, " " , " " ).foldLeft((Vector .empty[String ], false )) {
795
795
case ((acc, foundDifference), (expectedLine, actualLine)) if expectedLine == actualLine =>
796
796
(acc :+ actualLine, foundDifference)
@@ -816,4 +816,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
816
816
}
817
817
lines.mkString(" \n " )
818
818
}
819
+
820
+ private [sbtghactions] def removeWindowsLineEndings (string : String ): String =
821
+ string.replaceAll(" \\ r\\ n?" ," \n " )
819
822
}
0 commit comments