diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-10-11 12:58:07 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-10-11 11:03:50 +0000 |
commit | 17750ded9db8cb355e3219b9c2ff29f038d163b1 (patch) | |
tree | a48518d7c918d2648f0d6959d98bd807ff26f119 /git-hooks | |
parent | 85926c9d512e5d5d33a2cadfac1a834515399546 (diff) | |
download | qtrepotools-17750ded9db8cb355e3219b9c2ff29f038d163b1.tar.gz |
Fix inverted logic in clang-format-pre-commit
And ignore when there are no relevant files, such as this commit.
Change-Id: Ic8b747061822ad02538eacbcaa10f98332b6d9e7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
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" |