t1301: use test_when_finished for cleanup
commit5d64229ef5a98537bdea20faadfb5cf54ed077f7
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Tue, 29 Nov 2022 13:15:10 +0000 (29 21:15 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Nov 2022 01:21:51 +0000 (30 10:21 +0900)
tree82478ba1afb9a034c9e02d48a3d8d5b07d06a1f1
parenta0883a2440903bcfcb6b0f0c9d0439168258e819
t1301: use test_when_finished for cleanup

Refactor several test cases to use "test_when_finished" for cleanup.

1. For first of these, we used to clean-up outside the test, but instead
   let's use test_when_finished for that.

2. For the second, we used to leave "new" after we are done, but not use
   it at all later. Now we do clean up.

3. For the rest, these child.git test repositories used to follow
   "initialize what we are going to use to a known state before we use"
   pattern, which is not wrong per-se, but now we use "clean up the
   cruft we made after we are done" pattern, which may arguably be
   better simply because the test that makes cruft should know what
   cruft it created better than whatever comes later that may not know.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1301-shared-repo.sh