Restore the worktree after a failure

```git-check-assertions
run ./test/git-check-assertions.bats
assert_success
```
This commit is contained in:
Sven van Heugten 2026-03-04 07:39:07 +01:00
parent 99bcd7460f
commit 2299ee3407
No known key found for this signature in database
GPG key ID: D612F88666F4F660

View file

@ -84,6 +84,7 @@ for commit_hash in "${commits[@]}"; do
printf '%s\n' "$block" | sed 's/^/> /' printf '%s\n' "$block" | sed 's/^/> /'
if ! bash -euo pipefail -c "$block"; then if ! bash -euo pipefail -c "$block"; then
echo "git-check-assertions block failed in $commit_hash" >&2 echo "git-check-assertions block failed in $commit_hash" >&2
git restore -q .
echo "Returning to $orig_ref" echo "Returning to $orig_ref"
git checkout -q "$orig_ref" git checkout -q "$orig_ref"
exit 1 exit 1