diff options
author | Albert Astals Cid <aacid@kde.org> | 2020-06-18 23:54:45 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2020-07-03 23:52:17 +0200 |
commit | cd4feb323f005e3b0443572a1123683af5fab71b (patch) | |
tree | b48b4bfbf6f9f2c58d64941650ce30d40a857e7f | |
parent | 9d9e20bdcdaf8d6da562e792b9e5672193e714e2 (diff) |
Add .git-blame-ignore-revs and some instructions for clang-format
-rw-r--r-- | .git-blame-ignore-revs | 2 | ||||
-rw-r--r-- | README.contributors | 17 | ||||
-rwxr-xr-x | hooks/pre-commit | 10 |
3 files changed, 29 insertions, 0 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..15c2001c --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# _clang_format added +814fbda28cc8a37fed3134c2db8da28f86fb5ee0 diff --git a/README.contributors b/README.contributors index b23f964f..65cb95a0 100644 --- a/README.contributors +++ b/README.contributors @@ -18,4 +18,21 @@ Poppler has three main channels of contact: * The #poppler channel at the IRC freenode network Do not hesitate to drop by talk to people there. +clang-format +------------ +We introduced clang-format mandatory usage in July 2020. +If you want git blame to ignore the revision in which we did the mass change you can do + git config blame.ignoreRevsFile .git-blame-ignore-revs +on your clone + +To get the clang-format warnings locally instead at CI time we recommend you +to copy the hooks/pre-commit to your .git + cp hooks/pre-commit .git/hooks/ + +We are using clang-format 10 on CI. Unfortunately clang-format is not totally +compatible with older versions of itself. If CI gives you trouble but your local +clang-format disagrees, just apply the changes suggested by CI and then commit +with the --no-verify flag. If you get stuck, don't hesitate to ask the reviewer +to help and they will reformat your commits :) + And keep hacking on poppler! diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 00000000..6337bbbd --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +readonly output=$(git clang-format -v --diff) + +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 need to run git clang-format on your commit" +echo " git clang-format -f is potentially what you want" +exit 1 |