about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-10-08 12:02:41 +0200
committerPietro Albini <pietro@pietroalbini.org>2019-10-25 16:08:35 +0200
commit9c252f14bcfd987d6c1fb9fd4253336ab46fe7a5 (patch)
treed4bf0274103d1656f3acdac1c575718c367054d4 /src/ci/scripts
parent9a9d427ef903422301a62a02c2a90d9e7f7dbb2b (diff)
ci: extract verifying line endings into a script
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/verify-line-endings.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ci/scripts/verify-line-endings.sh b/src/ci/scripts/verify-line-endings.sh
new file mode 100755
index 00000000000..f3cac13ea48
--- /dev/null
+++ b/src/ci/scripts/verify-line-endings.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# See also the disable for autocrlf, this just checks that it worked.
+#
+# We check both in rust-lang/rust and in a submodule to make sure both are
+# accurate. Submodules are checked out significantly later than the main
+# repository in this script, so settings can (and do!) change between then.
+#
+# Linux (and maybe macOS) builders don't currently have dos2unix so just only
+# run this step on Windows.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+if isWindows; then
+    # print out the git configuration so we can better investigate failures in
+    # the following
+    git config --list --show-origin
+    dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
+    endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
+    # if endings has non-zero length, error out
+    if [ -n "$endings" ]; then exit 1 ; fi
+fi