Git fork

clang-format: add 'RemoveBracesLLVM' to the main config

In 1b8f306612 (ci/style-check: add `RemoveBracesLLVM` in CI job,
2024-07-23) we added 'RemoveBracesLLVM' to the CI job of running the
clang formatter.

This rule checks and warns against using braces on simple
single-statement bodies of statements. Since we haven't had any issues
regarding this rule, we can now move it into the main clang-format
config and remove it from being CI exclusive.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Karthik Nayak and committed by
Junio C Hamano
73d8380e 9e45fc6c

+7 -17
+6
.clang-format
··· 220 220 221 221 # Don't sort #include's 222 222 SortIncludes: false 223 + 224 + # Remove optional braces of control statements (if, else, for, and while) 225 + # according to the LLVM coding style. This avoids braces on simple 226 + # single-statement bodies of statements but keeps braces if one side of 227 + # if/else if/.../else cascade has multi-statement body. 228 + RemoveBracesLLVM: true
+1 -17
ci/run-style-check.sh
··· 5 5 6 6 baseCommit=$1 7 7 8 - # Remove optional braces of control statements (if, else, for, and while) 9 - # according to the LLVM coding style. This avoids braces on simple 10 - # single-statement bodies of statements but keeps braces if one side of 11 - # if/else if/.../else cascade has multi-statement body. 12 - # 13 - # As this rule comes with a warning [1], we want to experiment with it 14 - # before adding it in-tree. since the CI job for the style check is allowed 15 - # to fail, appending the rule here allows us to validate its efficacy. 16 - # While also ensuring that end-users are not affected directly. 17 - # 18 - # [1]: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#removebracesllvm 19 - { 20 - cat .clang-format 21 - echo "RemoveBracesLLVM: true" 22 - } >/tmp/clang-format-rules 23 - 24 - git clang-format --style=file:/tmp/clang-format-rules \ 8 + git clang-format --style=file:.clang-format \ 25 9 --diff --extensions c,h "$baseCommit"