From e0b1b3bbc1c796e3a35a723e875ec82c8ad371c0 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 7 Oct 2019 14:57:09 +0200 Subject: [PATCH] ci: extract disabling git crlf handling into a script --- .../steps/install-windows-build-deps.yml | 3 --- src/ci/azure-pipelines/steps/run.yml | 9 +++++++-- src/ci/scripts/disable-git-crlf-conversion.sh | 13 +++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100755 src/ci/scripts/disable-git-crlf-conversion.sh 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