Document support for multiple git-check-assertion blocks
This commit is contained in:
parent
35584c9aa7
commit
e5baffa698
1 changed files with 5 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ dotnet test --no-build
|
|||
```
|
||||
~~~
|
||||
|
||||
This script will be run with `set -euo pipefail`, and the commit will be considered correct if the script exits successfully.
|
||||
This script will be run with `set -euo pipefail` on the version of the code that is in the commit, and the commit will be considered correct if the script exits successfully.
|
||||
|
||||
You can technically assert that a command fails by writing `! ... || exit 1`, or write assertions about a command's output by piping it to `grep`, but doing so won't lead to very useful error messages when things go wrong. To make those things easier, there are some helper functions included, which are inspired by [bats](https://github.com/bats-core/bats-core) and [bats-assert](https://github.com/bats-core/bats-assert):
|
||||
|
||||
|
|
@ -77,6 +77,10 @@ You can technically assert that a command fails by writing `! ... || exit 1`, or
|
|||
|
||||
I'm considering taking `bats-assert` as a dependency, but for now, this very minimal set of functions with a similar interface should get you on your way.
|
||||
|
||||
## Multiple blocks in one commit message
|
||||
|
||||
You can include multiple `git-check-assertions` blocks in a single commit message. When you do, each individual block will run with a 'fresh' version of the commit, in which all changes that you made in the previous block have been undone.
|
||||
|
||||
## Cache of successful commits
|
||||
|
||||
After a commit's assertions run successfully, `git-check-assertions` appends the commit hash to `.git-check-assertions-cache` in the repo root. On the next run, any commit listed there is skipped.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue