Skip to content

Commit 58519e0

Browse files
committed
chore: fix spacing style
Change-Id: Ibc08dfccb2e725ff4c8992dad074fdb41b2d3063
1 parent 32b5dbe commit 58519e0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

.githooks.d/pre-commit.50.clang-format

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ set -e
66

77
# check if supported version exist
88
if ! which clang-format-13 >/dev/null; then
9-
echo "clang-format-13 is currently not installed"
10-
echo "Please install clang-format-13: sudo apt-get install clang-format-13"
11-
exit 1
9+
echo "clang-format-13 is currently not installed"
10+
echo "Please install clang-format-13: sudo apt-get install clang-format-13"
11+
exit 1
1212
fi
1313

1414
echo "--Checking style--"
1515

1616
patchfile="clang.patch"
1717

1818
# create patch
19-
git diff -U0 --no-color --cached | clang-format-diff-13 -p 1 -iregex ".*\.(c|cc|cpp|h|hh|hpp)" > $patchfile
20-
clangdiff=$( cat $patchfile )
19+
git diff -U0 --no-color --cached | clang-format-diff-13 -p 1 -iregex ".*\.(c|cc|cpp|h|hh|hpp)" >$patchfile
20+
clangdiff=$(cat $patchfile)
2121

2222
if [ "$clangdiff" ]; then
23-
cat $patchfile
24-
echo ""
25-
printf "Apply patch to fix code style? [y/n]: "
26-
exec < /dev/tty
27-
read answer
28-
if [ "$answer" = "y" ]; then
29-
echo "Applying patch ......"
30-
git apply -p 0 $patchfile
31-
git apply -p 0 --cached $patchfile
32-
else
33-
echo ""
34-
echo "Please fix coding style before submitting the patch"
35-
rm $patchfile
36-
exit 1;
37-
fi
23+
cat $patchfile
24+
echo ""
25+
printf "Apply patch to fix code style? [y/n]: "
26+
exec </dev/tty
27+
read -r answer
28+
if [ "$answer" = "y" ]; then
29+
echo "Applying patch ......"
30+
git apply -p 0 $patchfile
31+
git apply -p 0 --cached $patchfile
32+
else
33+
echo ""
34+
echo "Please fix coding style before submitting the patch"
35+
rm $patchfile
36+
exit 1
37+
fi
3838
fi
3939

4040
echo ""
4141
echo "--Checking style pass--"
4242

4343
# cleaning up
44-
rm $patchfile
44+
rm $patchfile

0 commit comments

Comments
 (0)