diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-09-13 16:19:26 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-09-21 08:16:24 +0000 |
commit | 0fd86a1cba3fea0fddd0a89a7f0f7fe62204d634 (patch) | |
tree | 51cfb3bd4d7bae63a9e27cfd428f155c6d1906a6 /git-hooks | |
parent | 925e5722f5c9647eca0744a905fe998cadd1a661 (diff) |
Don't block committing when clang-format produces a diff
clang-format producing a diff with possible format improvements is
useful, but shouldn't block a commit. The commit author can run
`git clang-format` and selectively add the changes the tool suggests the
commit by staging relevant chunks and ammending it.
Change-Id: I19d8bfc0749e2ecabcc2c298029daafda8ba9d55
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/clang-format-pre-commit | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git-hooks/clang-format-pre-commit b/git-hooks/clang-format-pre-commit index 1f97e61..ab5a8bc 100755 --- a/git-hooks/clang-format-pre-commit +++ b/git-hooks/clang-format-pre-commit @@ -30,9 +30,8 @@ fi if test -n "$CLANG_FORMAT_DIFF"; then echo "clang-format output:" echo "$CLANG_FORMAT_DIFF" - echo "clang-format detected change in format, please run:" - echo " git clang-format" - echo "and amend the change." - exit 1 + echo "clang-format suggests changes in the format. You can run:" + echo " git clang-format HEAD~1" + echo "and amend the commit with those changes that you agree with." + exit 0 fi - |