File tree Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Original file line number Diff line number Diff line change 66
77# check if supported version exist
88if ! 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
1212fi
1313
1414echo " --Checking style--"
1515
1616patchfile=" 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
2222if [ " $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
3838fi
3939
4040echo " "
4141echo " --Checking style pass--"
4242
4343# cleaning up
44- rm $patchfile
44+ rm $patchfile
You can’t perform that action at this time.
0 commit comments