Restore the commit between assertion blocks

```git-check-assertions
run ./test/git-check-assertions.bats
assert_success

git checkout HEAD~ bin
run ./test/git-check-assertions.bats
assert_failure
assert_output --partial "not ok 10 should restore the commit between assertion blocks in one commit message"
```
This commit is contained in:
Sven van Heugten 2026-03-11 22:09:39 +01:00
parent 7e483b8a7f
commit 35584c9aa7
No known key found for this signature in database
GPG key ID: D612F88666F4F660
2 changed files with 26 additions and 0 deletions

View file

@ -145,6 +145,31 @@ commit_with_assertion() {
assert_file_exists ../test2
}
@test "should restore the commit between assertion blocks in one commit message" {
git checkout -b feature
echo old >readme
git add readme
git commit -m "old"
echo new >readme
git add readme
git commit -F - <<-EOF
update
\`\`\`git-check-assertions
git checkout HEAD~
\`\`\`
\`\`\`git-check-assertions
grep new readme
\`\`\`
EOF
run git-check-assertions
assert_success
}
@test "should stop at the first failing assertion block and return to the original branch" {
git checkout -b feature
commit_with_assertion "touch ../test1 && exit 3"