diff options
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/clang-format-pre-commit | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git-hooks/clang-format-pre-commit b/git-hooks/clang-format-pre-commit index 25d87ec..a218ed3 100755 --- a/git-hooks/clang-format-pre-commit +++ b/git-hooks/clang-format-pre-commit @@ -12,12 +12,15 @@ # CLANG_FORMAT=`which git-clang-format` -if test -n "$CLANG_FORMAT"; then +if test -z "$CLANG_FORMAT"; then echo "Please install clang-format and make sure git-clang-format is in the path." exit 0 fi CLANG_FORMAT_DIFF=`git clang-format -q --diff` +if [ "$CLANG_FORMAT_DIFF" = "no modified files to format" ]; then + exit 0 +fi if test -n "$CLANG_FORMAT_DIFF"; then echo "clang-format output:" echo "$CLANG_FORMAT_DIFF" |