about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-10-07 14:57:09 +0200
committerPietro Albini <pietro@pietroalbini.org>2019-10-25 16:03:11 +0200
commite0b1b3bbc1c796e3a35a723e875ec82c8ad371c0 (patch)
tree1a64c62eab2eb8a7564dfd07d45009c5502677f6
parent6dd074a8f6bbf126492e15ea2eadaed54ac3d887 (diff)
downloadrust-e0b1b3bbc1c796e3a35a723e875ec82c8ad371c0.tar.gz
rust-e0b1b3bbc1c796e3a35a723e875ec82c8ad371c0.zip
ci: extract disabling git crlf handling into a script
-rw-r--r--src/ci/azure-pipelines/steps/install-windows-build-deps.yml3
-rw-r--r--src/ci/azure-pipelines/steps/run.yml9
-rwxr-xr-xsrc/ci/scripts/disable-git-crlf-conversion.sh13
3 files changed, 20 insertions, 5 deletions
diff --git a/src/ci/azure-pipelines/steps/install-windows-build-deps.yml b/src/ci/azure-pipelines/steps/install-windows-build-deps.yml
index 18860550e76..3c99ede9ade 100644
--- a/src/ci/azure-pipelines/steps/install-windows-build-deps.yml
+++ b/src/ci/azure-pipelines/steps/install-windows-build-deps.yml
@@ -1,7 +1,4 @@
 steps:
-- bash: git config --replace-all --global core.autocrlf false
-  displayName: "Disable git automatic line ending conversion (on C:/)"
-
 # Download and install MSYS2, needed primarily for the test suite (run-make) but
 # also used by the MinGW toolchain for assembling things.
 #
diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml
index 19745f3f8c9..df8e8e59d72 100644
--- a/src/ci/azure-pipelines/steps/run.yml
+++ b/src/ci/azure-pipelines/steps/run.yml
@@ -87,6 +87,10 @@ steps:
   displayName: Ensure the build happens on C:\ instead of D:\
   condition: and(succeeded(), not(variables.SKIP_JOB))
 
+- bash: src/ci/scripts/disable-git-crlf-conversion.sh
+  displayName: "Disable git automatic line ending conversion (on C:/)"
+  condition: and(succeeded(), not(variables.SKIP_JOB))
+
 - template: install-windows-build-deps.yml
 
 # Looks like docker containers have IPv6 disabled by default, so let's turn it
@@ -104,8 +108,9 @@ steps:
 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
 # be multiple -- but this should ensure submodules are checked out with the
 # appropriate line endings.
-- bash: git config --replace-all --global core.autocrlf false
-  displayName: "Disable git automatic line ending conversion"
+- bash: src/ci/scripts/disable-git-crlf-conversion.sh
+  displayName: Disable git automatic line ending conversion
+  condition: and(succeeded(), not(variables.SKIP_JOB))
 
 # Check out all our submodules, but more quickly than using git by using one of
 # our custom scripts
diff --git a/src/ci/scripts/disable-git-crlf-conversion.sh b/src/ci/scripts/disable-git-crlf-conversion.sh
new file mode 100755
index 00000000000..836145fbb8e
--- /dev/null
+++ b/src/ci/scripts/disable-git-crlf-conversion.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# Disable automatic line ending conversion, which is enabled by default on
+# Azure's Windows image. Having the conversion enabled caused regressions both
+# in our test suite (it broke miri tests) and in the ecosystem, since we
+# started shipping install scripts with CRLF endings instead of the old LF.
+#
+# Note that we do this a couple times during the build as the PATH and current
+# user/directory change, e.g. when mingw is enabled.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+git config --replace-all --global core.autocrlf false