Skip to content
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

Ignore line endings when comparing AsnXml generated content #101657

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

vcsjones
Copy link
Member

Some developers configure their git to check out files as LF instead of CRLF on Windows. That causes the diff detection for the AsnXml target to think the generator produced a meaningful change, when it really didn't. There unfortunately is not a good way to fix this in .gitattributes if the developer really insists that the line endings are LF on Windows, e.g:

git config --global core.autocrlf input
git config --global core.eol lf

We can't tell .gitattributes "No really, you definitely want to check these files out as CRLF on Windows and LF everywhere else".

Instead, we can just ignore the line endings for comparison sake. I could not figure out a way to do this in MSBuild, so I added a small C# task. I feel like this should be doable with <ReadLinesFromFile /> and comparing the Lines output, but I couldn't quite get that to work.

Fixes #101651

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@vcsjones vcsjones marked this pull request as ready for review April 28, 2024 21:05
@vcsjones vcsjones merged commit b88785f into dotnet:main Apr 29, 2024
79 of 84 checks passed
@vcsjones vcsjones deleted the asnxml-ignore-line-endings branch April 29, 2024 17:43
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
@vcsjones vcsjones added this to the 9.0.0 milestone Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean repository build results in: AsnXml regenerated files, be sure to check them in
3 participants