From d1bf922b1ab5608ed425339cfe41039d3ab75dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Wennerstr=C3=B6m?= Date: Tue, 7 Jul 2020 10:06:47 +0200 Subject: [PATCH 1/2] Tip about pre-push hook in contribution guidelines --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9b5bc7e..f4d83d66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,6 +19,22 @@ do done ``` +If you feel embarrassed every time the CI fails you can add the following +snippet to `.git/hooks/pre-push`: + +``` +#!/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 Before submitting a Pull Request please run valgrind and the clang static code analyzer. From 815a655768b2e8494c5cc31b5c65d14ad83a8e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Wennerstr=C3=B6m?= Date: Tue, 7 Jul 2020 10:11:31 +0200 Subject: [PATCH 2/2] Add highlighting --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4d83d66..52c65035 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ It might be a good idea to add a git pre-commit hook. So git automatically runs clang-format before doing a commit. You can add the following snippet to `.git/hooks/pre-commit`: -``` +```shell for f in $(git diff --cached --name-only) do clang-format -i $f @@ -22,7 +22,7 @@ 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