diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-07-13 20:19:31 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-08-03 19:40:23 +0800 |
commit | 0da144f4d48d7a423b8f61cd178bb41346083107 (patch) | |
tree | 0bdf31c067fc7991fea2ebef0831930b55b0069c /.gitignore | |
parent | 049c0464ce40cef17e8476b3e6b909bb10de469b (diff) | |
download | node-new-0da144f4d48d7a423b8f61cd178bb41346083107.tar.gz |
tools: add `make format-cpp` to run clang-format on C++ diffs
This patch adds a `make format-cpp` shortcut to the Makefile
that runs clang-format on the C++ diffs, and a
`make format-cpp-build` to install clang-format from
npm.
To format staged changes:
```
$ make format-cpp
```
To format HEAD~1...HEAD (latest commit):
```
$ CLANG_FORMAT_START=`git rev-parse HEAD~1` make format-cpp
```
To format diff between master and current branch head (master...HEAD):
```
$ CLANG_FORMAT_START=master make format-cpp
```
Most of the .clang-format file comes from running
```
$ clang-format --dump-config --style=Google
```
with clang-format built with llvm/trunk 328768 (npm version 1.2.3)
The clang-format version is fixed because different version of
clang-format may format the files differently.
PR-URL: https://github.com/nodejs/node/pull/21997
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to '.gitignore')
-rw-r--r-- | .gitignore | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 1d901b3a69..255a4c5a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ !test/fixtures/**/.* !tools/node_modules/**/.* !tools/doc/node_modules/**/.* +!.clang-format !.editorconfig !.eslintignore !.eslintrc.js |