Skip to content

Commit 63c00a6

Browse files
SiddharthShrimaligitster
authored andcommitted
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>
1 parent 67ad421 commit 63c00a6

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

t/t9123-git-svn-rebuild-with-rewriteroot.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ test_description='git svn respects rewriteRoot during rebuild'
77

88
. ./lib-git-svn.sh
99

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+
'
1619

1720
test_expect_success 'init, fetch and checkout repository' '
1821
git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" &&

0 commit comments

Comments
 (0)