From 4508d3f1b393ca0a0e2d4da18f5cbee6706c1048 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Fri, 20 Feb 2026 17:30:22 +0100 Subject: [PATCH] Make it possible to alter code inside of the bash script --- README.md | 11 +++++++++++ git-check-assertions.sh | 1 + 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 58f79f7..0b302ca 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,14 @@ dotnet build (assert_fails dotnet test --no-build) | grep "Invalid URL" ``` ~~~ + +Assert that a commit builds, and that a specific change breaks the tests (as discussed [here](https://sven.memcmp.org/2026-02-20-writing-the-steps-to-validate-a-test-in-the-commit-message/)): + +~~~ +```git-check-assertions +dotnet test +sed -i '/crucial code/d' Main.fs +dotnet build +assert_fails dotnet test --no-build +``` +~~~ diff --git a/git-check-assertions.sh b/git-check-assertions.sh index 1acab64..b0fe652 100755 --- a/git-check-assertions.sh +++ b/git-check-assertions.sh @@ -53,6 +53,7 @@ for commit_hash in "${commits[@]}"; do git checkout -q "$orig_ref" exit 1 fi + git restore -q . fi echo done