-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add autocrlf option for Windows #226
Comments
@jeroen have you considered setting the desired value for the repo, in the the .gitattributes file? |
I also just ran into this, resulting in modified line endings in a generated source tarball.
As @jeroen already mentioned, line translation can be useful for Windows users and their editors, so disabling it repository-wide might not be ideal. In this sense you just want consistent behaviour across the CI platforms, so specifying it at the CI-level makes sense to me. |
Coming from #250, this is an issue if git from MSYS2 is used. In my use cases, I found |
I just ran into this issue today. We don't want to use gitattributes because it imposes a way of working that developers might not like. And it's really only happening on Windows CI machines. |
@gtirloni you might find the workaround in https://github.com/msys2/setup-msys2#usage to be useful. |
If you repository contains submodules,
|
This seems to be a duplicate or at least closely related to #135. I am going to comment on the older issue. |
This workaround was suggested by jeroen in actions/checkout#226
By default the `actions/checkout` runner uses the default git settings for line ending normalization, which is `true`. For Windows, this means that `lf` line endings in files get converted to `crlf` on checkout. In the case of PHPCS, this is problematic as this means that the integration test, which runs PHPCS over the code in PHPCS itself, would fail on hundreds of `End of line character is invalid; expected "\n" but found "\r\n"` CS errors. Now, this line ending normalization can be undone via some config in `.gitattributes`, but that could negatively impact contributors who may prefer to have the line ending conversion when working on files in their local editors. So instead of that, this commit just turns it off in CI alone. The `core.autocrlf input` setting should leave the line-endings "as-is" when it gets checked out. Refs: * https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace * actions/checkout#135 * actions/checkout#226
By default the `actions/checkout` runner uses the default git settings for line ending normalization, which is `true`. For Windows, this means that `lf` line endings in files get converted to `crlf` on checkout. In the case of PHPCS, this is problematic as this means that the integration test, which runs PHPCS over the code in PHPCS itself, would fail on hundreds of `End of line character is invalid; expected "\n" but found "\r\n"` CS errors. Now, this line ending normalization can be undone via some config in `.gitattributes`, but that could negatively impact contributors who may prefer to have the line ending conversion when working on files in their local editors. So instead of that, this commit just turns it off in CI alone. The `core.autocrlf input` setting should leave the line-endings "as-is" when it gets checked out. Refs: * https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace * actions/checkout#135 * actions/checkout#226
I'm frequently debugging issues on my Windows builds which are due to the default git behavior of automatically changing line endings upon checkout. This default behavior sort-of makes sense for Windows users to edit text files in editors, but for CI it's really unfortunate.
It would be really nice to have a native option to disable autocrlf, and checkout the repo as-is.
Currently I use this as a workaround (before running this action):
But it would be nice if I could tell all the users of my action that they can just use:
Thanks!
The text was updated successfully, but these errors were encountered: