<div dir="ltr">I thought the handful of test files that require specific line endings were marked as "binary" so that git won't treat them as text.<div><br></div><div>I agree that, in theory, you don't want your source control to change your source code, and that's a complaint I've had about older source control systems that replace tokens like `$Version$` upon check-in. That's not the code you tested.</div><div><br></div><div>I've been getting by with `false` on Windows. You can tell Visual Studio (at least in 2017+) to warn you if you load a file with inconsistent line endings. I believe the VS 2019 editor has options to select which type of line endings you want be default. It will also show you the files line ending type in the status bar.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 16, 2020 at 9:36 AM Robinson, Paul via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-1925869442596885673WordSection1">
<p class="MsoNormal">Right, my understanding is that files that specifically need CRLF should say so via .gitattributes somewhere.<u></u><u></u></p>
<p class="MsoNormal">autocrlf=false ought to work if your Windows editor doesn’t (or can be persuaded not to) introduce CRLFs. I’ve observed that the Visual Studio editor will detect the line-ending style of the file you’re editing, and imitate it. This works
great until you create a new file. <span style="font-family:"Segoe UI Emoji",sans-serif">
😝</span> So I’ve learned to “create” a file by copying an existing file and then editing it.<u></u><u></u></p>
<p class="MsoNormal">I’m inclined to think the <a href="http://llvm.org" target="_blank">llvm.org</a> docs should say to use “input” on Windows, we’ve been happy with that in the Sony repo as James mentioned.<u></u><u></u></p>
<p class="MsoNormal">But I’d also like to hear from a Windows user from outside Sony first.<u></u><u></u></p>
<p class="MsoNormal">--paulr<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>Greg Bedwell via llvm-dev<br>
<b>Sent:</b> Thursday, January 16, 2020 12:27 PM<br>
<b>To:</b> <a href="mailto:jh7370.2008@my.bristol.ac.uk" target="_blank">jh7370.2008@my.bristol.ac.uk</a><br>
<b>Cc:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [llvm-dev] Git autocrlf for Windows - why does the Getting Started guide say to use false?<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">The previous discussion about it was here: <a href="https://reviews.llvm.org/D48494" target="_blank">
https://reviews.llvm.org/D48494</a><u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Personally I'd rather see if we could solve it with some clever use of .gitattributes rather than make it a user-setting but sadly I don't have time right now to commit to trying out a solution.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I notice that there is one case already of using .gitattributes to make sure autocrlf doesn't change line endings, FWIW:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://github.com/llvm/llvm-project/blob/master/llvm/.gitattributes#L19" target="_blank">https://github.com/llvm/llvm-project/blob/master/llvm/.gitattributes#L19</a> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, 16 Jan 2020 at 15:19, James Henderson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">TL;DR - should we recommend core.autocrlf=input instead of core.autocrlf=false on Windows?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I recently switched from doing pre-commit builds and tests from my Ubuntu VM, to my Windows machine where I do all my development. I was aware that line endings is an issue, so made sure to set core.autocrlf=false as directed in the Getting
Started guide (see <a href="https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm" target="_blank">
https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm</a> and
<a href="https://llvm.org/docs/GettingStarted.html#checkout-llvm-from-git" target="_blank">
https://llvm.org/docs/GettingStarted.html#checkout-llvm-from-git</a> which explicitly say to use "false"). This seemed a little odd to me, as that would mean that if I made any edits, I could potentially end up with Windows line endings, by my understanding,
but I assumed that I had misunderstood something, so just went along with it.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">However, at some point in one of my commits (at least I assume it was one of mine, since I was working on the file), I somehow managed to change an existing file to using Windows line endings, which someone else fixed for me (see commit
aca3e70d2bc0dd89b7d486c2a8eac70d8a89e790).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Having double-checked against my settings on my downstream clone, I noticed that I had core.autocrlf set to input there, and as far as I know, I've never had any line-ending problems with working with LLVM in that repo. My understanding
is "input" should avoid problems such as mine, i.e. by ensuring the checked-in files have LF line endings, whilst everybody, regardless of system will get native line endings in their actual clones. I am aware that there are some files that deliberately use
Windows line endings - I'm guessing that these are not widespread and that they don't need regularly modifying, so presumably those users who need to edit those files can change their setting as needed.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I'm happy to update the docs, but I want to make sure that any update I make is correct!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">James<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>