1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge pull request #1397 from wstrm/doc-pre-push-hook

Tip about pre-push hook in contribution guidelines
This commit is contained in:
Michael Vetter 2020-07-07 10:45:22 +02:00 committed by GitHub
commit 28fde3cd01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,13 +12,29 @@ It might be a good idea to add a git pre-commit hook.
So git automatically runs clang-format before doing a commit. So git automatically runs clang-format before doing a commit.
You can add the following snippet to `.git/hooks/pre-commit`: You can add the following snippet to `.git/hooks/pre-commit`:
``` ```shell
for f in $(git diff --cached --name-only) for f in $(git diff --cached --name-only)
do do
clang-format -i $f clang-format -i $f
done done
``` ```
If you feel embarrassed every time the CI fails you can add the following
snippet to `.git/hooks/pre-push`:
```shell
#!/bin/sh
set -e
./ci-build.sh
```
This will run the same tests that the CI runs and refuse the push if it fails.
Note that it will run on the actual content of the repository directory and not
what may have been staged/committed.
If you're in a hurry you can add the `--no-verify` flag when issuing `git push`
and the `pre-push` hook will be skipped.
## Pull Requests ## Pull Requests
Before submitting a Pull Request please run valgrind and the clang static code analyzer. Before submitting a Pull Request please run valgrind and the clang static code analyzer.