mirror of
https://invent.kde.org/graphics/okular
synced 2024-11-04 21:09:05 +00:00
Add .git-blame-ignore-revs and some instructions for clang-format
This commit is contained in:
parent
92e7c78f56
commit
4fb455220a
3 changed files with 26 additions and 0 deletions
2
.git-blame-ignore-revs
Normal file
2
.git-blame-ignore-revs
Normal file
|
@ -0,0 +1,2 @@
|
|||
# _clang_format added
|
||||
19d98d6a74079a42bcc5cb0e899d239a4bdb6e20
|
14
README.clang-format
Normal file
14
README.clang-format
Normal file
|
@ -0,0 +1,14 @@
|
|||
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 :)
|
10
hooks/pre-commit
Executable file
10
hooks/pre-commit
Executable file
|
@ -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
|
Loading…
Reference in a new issue