Merge pull request 'Restore the worktree after a failure' (#8) from restore-worktree-after-failure into main
Reviewed-on: https://codeberg.org/svenvanheugten/git-check-assertions/pulls/8
This commit is contained in:
commit
cb74f351f7
2 changed files with 11 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ for commit_hash in "${commits[@]}"; do
|
|||
printf '%s\n' "$block" | sed 's/^/> /'
|
||||
if ! bash -euo pipefail -c "$block"; then
|
||||
echo "git-check-assertions block failed in $commit_hash" >&2
|
||||
git restore -q .
|
||||
echo "Returning to $orig_ref"
|
||||
git checkout -q "$orig_ref"
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -99,6 +99,16 @@ commit_with_assertion() {
|
|||
assert_size_zero ../test
|
||||
}
|
||||
|
||||
@test "should restore worktree after a failure" {
|
||||
git checkout -b feature
|
||||
commit_with_assertion $'echo blah >> readme\nexit 3'
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_failure
|
||||
assert_size_zero readme
|
||||
}
|
||||
|
||||
@test "assertions should run against the version of the code inside of the commit" {
|
||||
git checkout -b feature
|
||||
echo commit1 >readme
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue