From 69f8acad8ffdd99bb48e31c99b6f29179304e301 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 11 Mar 2026 22:41:14 +0100 Subject: [PATCH] Print block number and remove redundant commit hash --- bin/git-check-assertions | 4 +++- test/git-check-assertions.bats | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/git-check-assertions b/bin/git-check-assertions index 4633914..685b591 100755 --- a/bin/git-check-assertions +++ b/bin/git-check-assertions @@ -110,8 +110,10 @@ for commit_hash in "${commits[@]}"; do printf '%s\n' "$commit_msg" | perl -0777 -ne 'while (/^```git-check-assertions\s*\n(.*?)^```\s*$/msg){ print $1, "\0" }' ) + block_num=0 for block in "${blocks[@]}"; do - echo "git-check-assertions block in $commit_hash:" + block_num=$((block_num + 1)) + echo "git-check-assertions block $block_num:" printf '%s' "$block" | sed 's/^/> /' if ! bash -euo pipefail -c "$block"; then echo "git-check-assertions block failed in $commit_hash" >&2 diff --git a/test/git-check-assertions.bats b/test/git-check-assertions.bats index 5ff0798..be3b275 100755 --- a/test/git-check-assertions.bats +++ b/test/git-check-assertions.bats @@ -141,6 +141,8 @@ commit_with_assertion() { run git-check-assertions assert_success + assert_output --partial "git-check-assertions block 1:" + assert_output --partial "git-check-assertions block 2:" assert_file_exists ../test1 assert_file_exists ../test2 }