]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t9123: use test_when_finished for cleanup
authorSiddharth Shrimali <r.siddharth.shrimali@gmail.com>
Thu, 5 Mar 2026 12:54:08 +0000 (18:24 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2026 19:36:43 +0000 (11:36 -0800)
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>
t/t9123-git-svn-rebuild-with-rewriteroot.sh

index ead404589eb622edd30adda06ad9684517b7e1f4..8fa5940abedfa51b9d20427b83fb414f31a511c6 100755 (executable)
@@ -7,12 +7,15 @@ test_description='git svn respects rewriteRoot during rebuild'
 
 . ./lib-git-svn.sh
 
-mkdir import
-(cd import
-       touch foo
-       svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
-)
-rm -rf import
+test_expect_success 'setup svn repository' '
+       test_when_finished "rm -rf import" &&
+       mkdir import &&
+       (
+               cd import &&
+               touch foo &&
+               svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
+       )
+       '
 
 test_expect_success 'init, fetch and checkout repository' '
        git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" &&