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