From e5baffa6989635e626d6248df7b1e6d9fd8c190c Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 11 Mar 2026 22:35:18 +0100 Subject: [PATCH] Document support for multiple git-check-assertion blocks --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2611a30..b3d4095 100644 --- a/README.md +++ b/README.md @@ -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.