On Sun, 19 Apr 2020 at 13:03, Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> wrote: > # fatal: unable to write file '(null)' mode 100644: Bad address > # Also, it had the unwanted side-effect of deleting f. (This comment looks a bit unnecessary, but that's not new.) > test_expect_success 'try to apply corrupted patch' ' > - test_must_fail git -c advice.amWorkDir=false am bad-patch.diff 2>actual > -' > - > -test_expect_success 'compare diagnostic; ensure file is still here' ' > + test_when_finished "git am --abort" && > + test_must_fail git -c advice.amWorkDir=false am bad-patch.diff 2>actual && > echo "error: git diff header lacks filename information (line 4)" >expected && > test_path_is_file f && > test_i18ncmp expected actual Makes sense. The first mini-test used to just set up "actual" and there was only one test using it, so it's hard to argue it was a "setup" phase. This looks better. Martin