diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2022-03-18 15:40:59 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2022-03-21 11:07:36 +0000 |
commit | da4ab76d01012f74d91d59b59c3366f3654a5b33 (patch) | |
tree | 54b26dd9111597d444c5f1945fdf09be8287a4b4 | |
parent | db2adb47940b4b1961c99cdab2a67cb2bb7ec440 (diff) | |
download | extra-cmake-modules-da4ab76d01012f74d91d59b59c3366f3654a5b33.tar.gz extra-cmake-modules-da4ab76d01012f74d91d59b59c3366f3654a5b33.tar.bz2 |
Fix clang-format git hook script
It should be --extensions "cpp,h,hpp,c"; previously, I naively tested that
it didn't bother .json files, but I not if it'll actually trigger for e.g.
a .h file...
-rwxr-xr-x | kde-modules/kde-git-commit-hooks/clang-format.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kde-modules/kde-git-commit-hooks/clang-format.sh b/kde-modules/kde-git-commit-hooks/clang-format.sh index c8bf7565..3e072768 100755 --- a/kde-modules/kde-git-commit-hooks/clang-format.sh +++ b/kde-modules/kde-git-commit-hooks/clang-format.sh @@ -2,7 +2,7 @@ # Based on okular/hooks/pre-commit, credits go to Albert Astals Cid -readonly output=$(git clang-format --extensions ".cpp, .h, .hpp, .c" -v --diff) +readonly output=$(git clang-format --extensions 'cpp,h,hpp,c' -v --diff) if [[ ! -f .clang-format ]]; then echo "ERROR: no .clang-format file found in repository root, abort format" @@ -13,6 +13,6 @@ if [[ "$output" == *"no modified files to format"* ]]; then exit 0; fi if [[ "$output" == *"clang-format did not modify any files"* ]]; then exit 0; fi echo "ERROR: You have unformatted changes, please format your files. You can do this using the following commands:" -echo " git clang-format --force # format the changed parts" -echo " git clang-format --diff # preview the changes done by the formatter" +echo " git clang-format --extensions 'cpp,h,hpp,c' --force # format the changed parts" +echo " git clang-format --extensions 'cpp,h,hpp,c' --diff # preview the changes done by the formatter" exit 1 |