Closed xantari closed 4 years ago
This was a tough one. It's caused by the build machine's interpretation of line endings. It's not possible to reproduce it with a locally-built package.
It could possibly be fixed by configuring git config --global core.autocrlf true
in appveyor.yml as suggested here
init:
- git config --global core.autocrlf true
But this would only move the problem somewhere else.
A better option would be to configure the Roslyn formatter to use pre-configured line endings:
var workspace = new AdhocWorkspace();
workspace.Options = workspace.Options
.WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, Environment.NewLine);
Which is supposed to work but it probably doesn't work for nodes that already contain line breaks.
In the end, the fix is purely text-based and it replaces all line endings with Environment.NewLine
(CRLF on windows). It'll be part of the v5 release.
Currently, there is no way of configuring the line ending format. Should there be a need for it, please submit a new feature request.
Scenarios with multiple devs working on different operating systems should be possible to solve by setting core.autocrlf
to true
in .gitattributes
.
Brief bug description
Please provide an option in the command line tool to pick your carriage return format. Currently, when we regenerate the models all the .Generated models show up as being modified even though there are no changes to the generated model.
This is due to the introduction of mixed carriage return formats in the output.
Carriage returns usually cause this behavior and the ideal solution would be to have the option of picking your carriage return format (LF vs CRLF).
See here for a re-generated model that got considered by Git as a change, even though it was not substantively different, only the carriage returns were.
Repro steps
I'm using the following command to regenerate my models using beta-2 generators command line:
dotnet tool restore dotnet tool run KontentModelGenerator -p "myproject_guid" -o "..\ContentTypes" -n "ARRT.Web.Models" -g true -s true -f "Generated" -b "ContentTypeBase"
Expected behavior
Consistent carriage returns on each execution of the dotnet kontent generator.