2 # SPDX-FileCopyrightText: 2023 Michael Jeanson <mjeanson@efficios.com>
3 # SPDX-License-Identifier: GPL-2.0-or-later
14 message_len
="${#message}"
15 padding_len
=$
(( (80 - (message_len
)) / 2 ))
18 printf '\n'; printf -- '#%.0s' {1.
.80}; printf '\n'
19 printf -- '-%.0s' {1.
.80}; printf '\n'
20 printf -- '#%.0s' $
(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $
(seq 1 $padding_len); printf '\n'
21 printf -- '-%.0s' {1.
.80}; printf '\n'
22 printf -- '#%.0s' {1.
.80}; printf '\n\n'
27 cd "src/$PROJECT_NAME"
29 # Check if the topmost patch is properly formatted
30 git
diff -U0 --no-color --relative HEAD^ | clang-format-diff-14
-p1 -i
32 # If the tree has local changes, the formatting was incorrect
33 GIT_DIFF_OUTPUT
=$
(git
diff)
34 if [ -n "$GIT_DIFF_OUTPUT" ]; then
35 print_header
"Saving clang-format proposed fixes in clang-format-fixes.diff"
36 git
diff > "$WORKSPACE/clang-format-fixes.diff"
40 print_header
"clang-format is happy!"