<div dir="ltr">In general, I think you're asking for trouble if your source control system is doing anything other than storing the bits you send to it.  It shouldn't be editing files for you.<div><br></div><div>There are some places where we specifically want to test that tools behave correctly with certain line endings, and core.autocrlf=input will break those tests.  That could probably be solved with proper use of .gitattributes files, but as Greg mentions, we aren't there yet.</div><div><br></div><div>My solution for this in the past has been to use a git extension command which I call `dos2unix` so that I can run `git dos2unix` and it will run through my list of staged changes, run dos2unix on all of them, and then I can `git add -u` the result.  This ensures I'm always committing unix line endings.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 16, 2020 at 7:19 AM James Henderson 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 dir="ltr"><div>Hi all,</div><div><br></div><div>TL;DR - should we recommend core.autocrlf=input instead of core.autocrlf=false on Windows?<br></div><div><br></div><div>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.</div><div><br></div><div>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 
<span><span>aca3e70d2bc0dd89b7d486c2a8eac70d8a89e790</span></span>).</div><div><br></div><div>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.</div><div><br></div><div>I'm happy to update the docs, but I want to make sure that any update I make is correct!</div><div><br></div><div>James<br></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>