ci: extract disabling git crlf handling into a script

This commit is contained in:
Pietro Albini 2019-10-07 14:57:09 +02:00
parent 6dd074a8f6
commit e0b1b3bbc1
No known key found for this signature in database
GPG Key ID: 3E06ABE80BAAF19C
3 changed files with 20 additions and 5 deletions

View File

@ -1,7 +1,4 @@
steps: 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 # Download and install MSYS2, needed primarily for the test suite (run-make) but
# also used by the MinGW toolchain for assembling things. # also used by the MinGW toolchain for assembling things.
# #

View File

@ -87,6 +87,10 @@ steps:
displayName: Ensure the build happens on C:\ instead of D:\ displayName: Ensure the build happens on C:\ instead of D:\
condition: and(succeeded(), not(variables.SKIP_JOB)) 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 - template: install-windows-build-deps.yml
# Looks like docker containers have IPv6 disabled by default, so let's turn it # 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 # 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 # be multiple -- but this should ensure submodules are checked out with the
# appropriate line endings. # appropriate line endings.
- bash: git config --replace-all --global core.autocrlf false - bash: src/ci/scripts/disable-git-crlf-conversion.sh
displayName: "Disable git automatic line ending conversion" 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 # Check out all our submodules, but more quickly than using git by using one of
# our custom scripts # our custom scripts

View File

@ -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