t9123: use test_when_finished for cleanup

Move the setup logic into a 'test_expect_success' block. This ensures that the code is properly tracked by the test harness. Additionally, we use the 'test_when_finished' helper at the start of the block to ensure that the 'import' directory is removed even if the test fails. This is cleaner than the previous manual 'rm -rf import' approach. Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Siddharth Shrimali committed Mar 5, 2026 at 18:24 UTC 63c00a677b2b44e0691919b36a417cee648d890d
1 file changed +9 -6
t/t9123-git-svn-rebuild-with-rewriteroot.sh
+9 -6
@@ -7,12 +7,15 @@ test_description='git svn respects rewriteRoot during rebuild'
7
8 . ./lib-git-svn.sh
9
10 -mkdir import
11 -(cd import
12 - touch foo
13 - svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
14 -)
15 -rm -rf import
10 +test_expect_success 'setup svn repository' '
11 + test_when_finished "rm -rf import" &&
12 + mkdir import &&
13 + (
14 + cd import &&
15 + touch foo &&
16 + svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
17 + )
18 + '
19
20 test_expect_success 'init, fetch and checkout repository' '
21 git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" &&