-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use LF as git end of line terminator on Windows #899
base: master
Are you sure you want to change the base?
Use LF as git end of line terminator on Windows #899
Conversation
Windows virtual machines are currently configured to not use LF as their git end of line. That causes failures when spotless formats files on Windows that were originally created with Unix (LF) line termination. This is a workaround until we update the Windows virtual machine definition to fix: * jenkins-infra/helpdesk#3865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mentioned elsewhere, this PR should go along #898 as
plugins that use spotless will fail their builds on a Windows VM when they pass on a Windows container. Switch from container to VM makes that issue visible to more people.
Related:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Mark!
@lemeurherveCB suggested a technique that I can use to test this before it is merged. I'll do that testing before I merge it. |
CC @jtnord |
@@ -142,6 +142,8 @@ Object checkoutSCM(String repo = null) { | |||
// Enable long paths to avoid problems with tests on Windows agents | |||
if (!isUnix()) { | |||
bat 'git config --global core.longpaths true' | |||
// TODO: Remove when https://github.com/jenkins-infra/helpdesk/issues/3865 is resolved | |||
bat 'git config --global core.eol lf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the spotless issue is that it ends up just guessing that the line ending is native becasue there is no configuration otherwise.
The alternative (which uses windows line ends on windows, so is more like what windows would do) is to set git config --global core.autocrlf true
this should cause the files to have line ends changed on windows, and will be picked up by spotless to go "oh it is converting line ends, and I am on windows" so spotless does not end up guessing.
Use LF as git end of line terminator on Windows
Windows virtual machines are currently configured to not use LF as their git end of line. That causes failures when spotless formats files on Windows that were originally created with Unix (LF) line termination.
This is a workaround until we update the Windows virtual machine definition to fix: