This is an archive of the discontinued LLVM Phabricator instance.

[MC] Fix regression tests on Windows when git “core.autocrlf” is set to true
ClosedPublic

Authored by caoz on Nov 7 2017, 8:45 AM.

Diff Detail

Event Timeline

caoz created this revision.Nov 7 2017, 8:45 AM
belleyb added a subscriber: belleyb.Nov 7 2017, 9:50 AM
rnk edited edge metadata.Nov 7 2017, 10:07 AM

Please add a regression test that tests your code change when the repo is checked out with normal line feeds. That way we can catch regressions for this on Linux.

lib/MC/MCParser/AsmLexer.cpp
213

This assumes the next character is '\n', which was not the case on Mac OS 9. Please check this assumption.

624

Indentation should use two spaces, not four, here and above.

caoz updated this revision to Diff 121978.EditedNov 7 2017, 1:54 PM

Thanks Reid. The fix doesn't have regressions on Linux, as it supports both styles of line ending ("\r\n" and "\n").

rnk added a comment.Nov 7 2017, 2:43 PM
In D39737#918425, @caoz wrote:

Thanks Reid. The fix doesn't have regressions on Linux, as it supports both styles of line ending ("\r\n" and "\n").

I'm sure it's possible to add regression tests that run on Linux with .gitattributes.

caoz updated this revision to Diff 122169.Nov 8 2017, 3:53 PM

Thank the reviewers for your comments. I added a regression test for Linux. This solves the line ending issue for git. I would appreciate it If anyone could let me know a solution for svn.

With svn, this is controlled by svn:eol-style and svn:mime-type.

That said, we don't have to worry about any of this if you just configure your git or svn client not to mess with line endings.

caoz updated this revision to Diff 122349.Nov 9 2017, 3:52 PM

Thank Eli and Zachary for your help on source control system settings.

zturner added a subscriber: zturner.Nov 9 2017, 3:54 PM

Ahh sorry, I may have misunderstood your previous question. I thought we were talking about setting core.autocrlf=false at the global LLVM .gitattributes file, and then not having anything special for this one particular test.

caoz added a comment.Nov 10 2017, 6:23 AM

Ahh sorry, I may have misunderstood your previous question. I thought we were talking about setting core.autocrlf=false at the global LLVM .gitattributes file, and then not having anything special for this one particular test.

Do you think we should add the .gitattributes file? Thanks.

rnk accepted this revision.Nov 16 2017, 11:44 AM

lgtm

This revision is now accepted and ready to land.Nov 16 2017, 11:44 AM
This revision was automatically updated to reflect the committed changes.