|
@@ -5,7 +5,7 @@
|
|
# the staged changes.
|
|
# the staged changes.
|
|
#
|
|
#
|
|
# To install, copy this script to `.git/hooks/pre-commit`:
|
|
# To install, copy this script to `.git/hooks/pre-commit`:
|
|
-# ln -s ../../tools/clang-format_precommit_hook .git/hooks/pre-commit
|
|
|
|
|
|
+# cd .git/hooks && ln -s ../../tools/clang-format_precommit_hook pre-commit
|
|
# and make sure that `clang-format` is installed on your system
|
|
# and make sure that `clang-format` is installed on your system
|
|
|
|
|
|
maj_min=1
|
|
maj_min=1
|
|
@@ -52,5 +52,12 @@ fi
|
|
# do the formatting
|
|
# do the formatting
|
|
for file in `git diff-index --cached --name-only $against`
|
|
for file in `git diff-index --cached --name-only $against`
|
|
do
|
|
do
|
|
- "$format" -i "$file"
|
|
|
|
|
|
+ case "$file" in
|
|
|
|
+ *.h | *.hpp | *.c | *.cpp )
|
|
|
|
+ "$format" -i "$file"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ # do nothing with file
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
done
|
|
done
|