[libcxx-commits] [PATCH] D92229: [libc++] Update clang-format configuration

Nico Weber via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 28 10:43:00 PST 2020


thakis added a comment.

If the idea is to reformat everything, I'd recommend just using the normal LLVM style, like the rest of the project.

In D92229#2420240 <https://reviews.llvm.org/D92229#2420240>, @ldionne wrote:

> In D92229#2420176 <https://reviews.llvm.org/D92229#2420176>, @miscco wrote:
>
>> I really like that we get clang-format to work. Live is simply to short to worry about formatting.
>>
>> I assume we should simply make one monster commit adding that to the exception list for git blame and be done with it
>
> That would still make it more difficult to blame stuff if lines move around a lot. Another option would be to mandate that we clang-format everything we touch from now on. Thus, as we make changes to the library, the lines we change (and some amount of surrounding context) would be re-formatted. I'm not sure which approach is best, since I haven't done it before. I'd be curious to hear stories of folks who moved existing codebases to Clang format.

This is a mostly solved problem: Git 2.23 added support for ignoring whitespace commits in blame output. You store hashes that should be blame-transparent in a file called `.git-blame-ignore-revs` (or any other name), check that file in, and then either pass `--ignore-revs-file .git-blame-ignore-revs` to `git blame` or run `git config blame.ignoreRevsFile .git-blame-ignore-revs` once to make `git blame` always use that blame file.

We auto-formatted a big chunk of Chromium's code a while ago. We did this before git 2.23 so we wrote a custom tool that does the same thing (https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html), but with git 2.23+ there's even upstream support for this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92229/new/

https://reviews.llvm.org/D92229



More information about the libcxx-commits mailing list