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>

Karthik Nayak committed Jul 2, 2025 at 11:23 UTC 73d8380e56087ac0a4285596e74444e26d01fb89
2 files changed +7 -17
.clang-format
+6
@@ -220,3 +220,9 @@ KeepEmptyLinesAtTheStartOfBlocks: false
220
221 # Don't sort #include's
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
ci/run-style-check.sh
+1 -17
@@ -5,21 +5,5 @@
5
6 baseCommit=$1
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 \
9 --diff --extensions c,h "$baseCommit"