Wrap assertion checking in a function

This commit is contained in:
Sven van Heugten 2026-04-15 20:49:16 +02:00
parent ad5a6985ba
commit d92713930e
No known key found for this signature in database
GPG key ID: D612F88666F4F660

View file

@ -118,7 +118,10 @@ for commit_hash in "${commits[@]}"; do
block_num=$((block_num + 1)) block_num=$((block_num + 1))
echo "git-check-assertions block $block_num:" echo "git-check-assertions block $block_num:"
printf '%s' "$block" | sed 's/^/> /' printf '%s' "$block" | sed 's/^/> /'
if ! bash -euo pipefail -c "$block"; then check_assertions() {
bash -euo pipefail -c "$block"
}
if ! check_assertions; then
echo "git-check-assertions block failed in $commit_hash" >&2 echo "git-check-assertions block failed in $commit_hash" >&2
restore restore
echo "Returning to $orig_ref" echo "Returning to $orig_ref"