mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 03:36:37 +00:00

Historically, we've not automatically enforced how git tracks line endings, but there are many, many commits that "undo" unintended CRLFs getting into history. `git log --pretty=oneline --grep=CRLF` shows nearly 100 commits involving reverts of CRLF making its way into the index and then history. As far as I can tell, there are none the other way round except for specific cases like `.bat` files or tests for parsers that need to accept such sequences. Of note, one of the earliest of those listed in that output is: ``` commit 9795860250734e5c2a879546c534e35d9edd5944 Author: NAKAMURA Takumi <geek4civic@gmail.com> Date: Thu Feb 3 11:41:27 2011 +0000 cmake/*: Add svn:eol-style=native and fix CRLF. llvm-svn: 124793 ``` ...which introduced such a defacto policy for subversion. With old versions of git, it's been a bit of a crap-shoot whether enforcing storing line endings in the history will upset checkouts on machines where such line endings are the norm. Indeed many users have enforced that git checks out the working copy according to a global or per-user config via core crlf, or core autocrlf. For ~8 years now[1], however, git has supported the ability to "do as the Romans do" on checkout, but internally store subsets of text files with line-endings specified via a system of patterns in the `.gitattributes` file. Since we now have this ability, and we've been specifying attributes for various binary files, I think it makes sense to rid us of all that work converting things "back", and just let git handle the local checkout. Thus the new toplevel policy here is * text=auto In simple terms this means "unless otherwise specified, convert all files considered "text" files to LF in the project history, but check them out as expected on the local machine. What is "expected on the local machine" is dependent on configuration and default. For those files in the repository that *do* need CRLF endings, I've adopted a policy of `eol=crlf` which means that git will store them in history with LF, but regardless of user config, they'll be checked out in tree with CRLF. Finally, existing files have been "corrected" in history via `git add --renormalize .` End users should *not* need to adjust their local git config or workflow. [1]: git 2.10 was released with fixed support for fine-grained line-ending tracking that respects user-config *and* repo policy. This can be considered the point at which git will respect both the user's local working tree preference *and* the history as specified by the maintainers. See https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248 for the release note.
150 lines
9.2 KiB
Plaintext
150 lines
9.2 KiB
Plaintext
# Checkout as native, commit as LF except in specific circumstances
|
|
* text=auto
|
|
*.bat text eol=crlf
|
|
*.rc text eol=crlf
|
|
*.sln text eol=crlf
|
|
*.natvis text eol=crlf
|
|
|
|
libcxx/src/**/*.cpp merge=libcxx-reformat
|
|
libcxx/include/**/*.h merge=libcxx-reformat
|
|
|
|
# Explicitly handle files with no extension
|
|
libcxx/include/__availability merge=libcxx-reformat
|
|
libcxx/include/__bit_reference merge=libcxx-reformat
|
|
libcxx/include/__config merge=libcxx-reformat
|
|
libcxx/include/__hash_table merge=libcxx-reformat
|
|
libcxx/include/__locale merge=libcxx-reformat
|
|
libcxx/include/__node_handle merge=libcxx-reformat
|
|
libcxx/include/__split_buffer merge=libcxx-reformat
|
|
libcxx/include/__std_clang_module merge=libcxx-reformat
|
|
libcxx/include/__threading_support merge=libcxx-reformat
|
|
libcxx/include/__tree merge=libcxx-reformat
|
|
libcxx/include/__verbose_abort merge=libcxx-reformat
|
|
libcxx/include/algorithm merge=libcxx-reformat
|
|
libcxx/include/any merge=libcxx-reformat
|
|
libcxx/include/array merge=libcxx-reformat
|
|
libcxx/include/atomic merge=libcxx-reformat
|
|
libcxx/include/barrier merge=libcxx-reformat
|
|
libcxx/include/bit merge=libcxx-reformat
|
|
libcxx/include/bitset merge=libcxx-reformat
|
|
libcxx/include/cassert merge=libcxx-reformat
|
|
libcxx/include/ccomplex merge=libcxx-reformat
|
|
libcxx/include/cctype merge=libcxx-reformat
|
|
libcxx/include/cerrno merge=libcxx-reformat
|
|
libcxx/include/cfenv merge=libcxx-reformat
|
|
libcxx/include/cfloat merge=libcxx-reformat
|
|
libcxx/include/charconv merge=libcxx-reformat
|
|
libcxx/include/chrono merge=libcxx-reformat
|
|
libcxx/include/cinttypes merge=libcxx-reformat
|
|
libcxx/include/ciso646 merge=libcxx-reformat
|
|
libcxx/include/climits merge=libcxx-reformat
|
|
libcxx/include/clocale merge=libcxx-reformat
|
|
libcxx/include/cmath merge=libcxx-reformat
|
|
libcxx/include/codecvt merge=libcxx-reformat
|
|
libcxx/include/compare merge=libcxx-reformat
|
|
libcxx/include/complex merge=libcxx-reformat
|
|
libcxx/include/concepts merge=libcxx-reformat
|
|
libcxx/include/condition_variable merge=libcxx-reformat
|
|
libcxx/include/coroutine merge=libcxx-reformat
|
|
libcxx/include/csetjmp merge=libcxx-reformat
|
|
libcxx/include/csignal merge=libcxx-reformat
|
|
libcxx/include/cstdarg merge=libcxx-reformat
|
|
libcxx/include/cstdbool merge=libcxx-reformat
|
|
libcxx/include/cstddef merge=libcxx-reformat
|
|
libcxx/include/cstdint merge=libcxx-reformat
|
|
libcxx/include/cstdio merge=libcxx-reformat
|
|
libcxx/include/cstdlib merge=libcxx-reformat
|
|
libcxx/include/cstring merge=libcxx-reformat
|
|
libcxx/include/ctgmath merge=libcxx-reformat
|
|
libcxx/include/ctime merge=libcxx-reformat
|
|
libcxx/include/cuchar merge=libcxx-reformat
|
|
libcxx/include/cwchar merge=libcxx-reformat
|
|
libcxx/include/cwctype merge=libcxx-reformat
|
|
libcxx/include/deque merge=libcxx-reformat
|
|
libcxx/include/exception merge=libcxx-reformat
|
|
libcxx/include/execution merge=libcxx-reformat
|
|
libcxx/include/expected merge=libcxx-reformat
|
|
libcxx/include/experimental/__config merge=libcxx-reformat
|
|
libcxx/include/experimental/__memory merge=libcxx-reformat
|
|
libcxx/include/experimental/deque merge=libcxx-reformat
|
|
libcxx/include/experimental/forward_list merge=libcxx-reformat
|
|
libcxx/include/experimental/iterator merge=libcxx-reformat
|
|
libcxx/include/experimental/list merge=libcxx-reformat
|
|
libcxx/include/experimental/map merge=libcxx-reformat
|
|
libcxx/include/experimental/memory merge=libcxx-reformat
|
|
libcxx/include/experimental/memory_resource merge=libcxx-reformat
|
|
libcxx/include/experimental/propagate_const merge=libcxx-reformat
|
|
libcxx/include/experimental/regex merge=libcxx-reformat
|
|
libcxx/include/experimental/set merge=libcxx-reformat
|
|
libcxx/include/experimental/simd merge=libcxx-reformat
|
|
libcxx/include/experimental/string merge=libcxx-reformat
|
|
libcxx/include/experimental/type_traits merge=libcxx-reformat
|
|
libcxx/include/experimental/unordered_map merge=libcxx-reformat
|
|
libcxx/include/experimental/unordered_set merge=libcxx-reformat
|
|
libcxx/include/experimental/utility merge=libcxx-reformat
|
|
libcxx/include/experimental/vector merge=libcxx-reformat
|
|
libcxx/include/ext/__hash merge=libcxx-reformat
|
|
libcxx/include/ext/hash_map merge=libcxx-reformat
|
|
libcxx/include/ext/hash_set merge=libcxx-reformat
|
|
libcxx/include/filesystem merge=libcxx-reformat
|
|
libcxx/include/format merge=libcxx-reformat
|
|
libcxx/include/forward_list merge=libcxx-reformat
|
|
libcxx/include/fstream merge=libcxx-reformat
|
|
libcxx/include/functional merge=libcxx-reformat
|
|
libcxx/include/future merge=libcxx-reformat
|
|
libcxx/include/initializer_list merge=libcxx-reformat
|
|
libcxx/include/iomanip merge=libcxx-reformat
|
|
libcxx/include/ios merge=libcxx-reformat
|
|
libcxx/include/iosfwd merge=libcxx-reformat
|
|
libcxx/include/iostream merge=libcxx-reformat
|
|
libcxx/include/istream merge=libcxx-reformat
|
|
libcxx/include/iterator merge=libcxx-reformat
|
|
libcxx/include/latch merge=libcxx-reformat
|
|
libcxx/include/limits merge=libcxx-reformat
|
|
libcxx/include/list merge=libcxx-reformat
|
|
libcxx/include/locale merge=libcxx-reformat
|
|
libcxx/include/map merge=libcxx-reformat
|
|
libcxx/include/mdspan merge=libcxx-reformat
|
|
libcxx/include/memory merge=libcxx-reformat
|
|
libcxx/include/memory_resource merge=libcxx-reformat
|
|
libcxx/include/mutex merge=libcxx-reformat
|
|
libcxx/include/new merge=libcxx-reformat
|
|
libcxx/include/numbers merge=libcxx-reformat
|
|
libcxx/include/numeric merge=libcxx-reformat
|
|
libcxx/include/optional merge=libcxx-reformat
|
|
libcxx/include/ostream merge=libcxx-reformat
|
|
libcxx/include/print merge=libcxx-reformat
|
|
libcxx/include/queue merge=libcxx-reformat
|
|
libcxx/include/random merge=libcxx-reformat
|
|
libcxx/include/ranges merge=libcxx-reformat
|
|
libcxx/include/ratio merge=libcxx-reformat
|
|
libcxx/include/regex merge=libcxx-reformat
|
|
libcxx/include/scoped_allocator merge=libcxx-reformat
|
|
libcxx/include/semaphore merge=libcxx-reformat
|
|
libcxx/include/set merge=libcxx-reformat
|
|
libcxx/include/shared_mutex merge=libcxx-reformat
|
|
libcxx/include/source_location merge=libcxx-reformat
|
|
libcxx/include/span merge=libcxx-reformat
|
|
libcxx/include/sstream merge=libcxx-reformat
|
|
libcxx/include/stack merge=libcxx-reformat
|
|
libcxx/include/stdexcept merge=libcxx-reformat
|
|
libcxx/include/stop_token merge=libcxx-reformat
|
|
libcxx/include/streambuf merge=libcxx-reformat
|
|
libcxx/include/string merge=libcxx-reformat
|
|
libcxx/include/string_view merge=libcxx-reformat
|
|
libcxx/include/strstream merge=libcxx-reformat
|
|
libcxx/include/syncstream merge=libcxx-reformat
|
|
libcxx/include/system_error merge=libcxx-reformat
|
|
libcxx/include/thread merge=libcxx-reformat
|
|
libcxx/include/tuple merge=libcxx-reformat
|
|
libcxx/include/type_traits merge=libcxx-reformat
|
|
libcxx/include/typeindex merge=libcxx-reformat
|
|
libcxx/include/typeinfo merge=libcxx-reformat
|
|
libcxx/include/unordered_map merge=libcxx-reformat
|
|
libcxx/include/unordered_set merge=libcxx-reformat
|
|
libcxx/include/utility merge=libcxx-reformat
|
|
libcxx/include/valarray merge=libcxx-reformat
|
|
libcxx/include/variant merge=libcxx-reformat
|
|
libcxx/include/vector merge=libcxx-reformat
|
|
libcxx/include/version merge=libcxx-reformat
|