1212# Azure's Windows image. Having the conversion enabled caused regressions both
1313# in our test suite (it broke miri tests) and in the ecosystem, since we
1414# started shipping install scripts with CRLF endings instead of the old LF.
15+ #
16+ # Note that we do this a couple times during the build as the PATH and current
17+ # user/directory change, e.g. when mingw is enabled.
1518- bash : git config --global core.autocrlf false
1619 displayName : " Disable git automatic line ending conversion"
1720
@@ -70,6 +73,14 @@ steps:
7073 displayName : Enable IPv6
7174 condition : and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
7275
76+ # Disable automatic line ending conversion (again). On Windows, when we're
77+ # installing dependencies, something switches the git configuration directory or
78+ # re-enables autocrlf. We've not tracked down the exact cause -- and there may
79+ # be multiple -- but this should ensure submodules are checked out with the
80+ # appropriate line endings.
81+ - bash : git config --replace-all --global core.autocrlf false
82+ displayName : " Disable git automatic line ending conversion"
83+
7384# Check out all our submodules, but more quickly than using git by using one of
7485# our custom scripts
7586- bash : |
@@ -84,6 +95,26 @@ steps:
8495 condition : and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
8596 displayName : Check out submodules (Windows)
8697
98+ # See also the disable for autocrlf above, this just checks that it worked
99+ #
100+ # We check both in rust-lang/rust and in a submodule to make sure both are
101+ # accurate. Submodules are checked out significantly later than the main
102+ # repository in this script, so settings can (and do!) change between then.
103+ #
104+ # Linux (and maybe macOS) builders don't currently have dos2unix so just only
105+ # run this step on Windows.
106+ - bash : |
107+ set -x
108+ # print out the git configuration so we can better investigate failures in
109+ # the following
110+ git config --list --show-origin
111+ dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
112+ endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
113+ # if endings has non-zero length, error out
114+ if [ -n "$endings" ]; then exit 1 ; fi
115+ condition : and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
116+ displayName : Verify line endings are LF
117+
87118# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
88119# images, etc.
89120- bash : |
0 commit comments