Skip to content

Commit fa3142c

Browse files
peffgitster
authored andcommitted
t7610: clean up foo.XXXXXX tmpdir
The lazy prereq for MKTEMP uses "mktemp -t" to see if mergetool's internal mktemp call will be able to run. But unlike the call inside mergetool, we do not ever bother to clean up the result, and the /tmp of git developers will slowly fill up with "foo.XXXXXX" directories as they run the test suite over and over. Let's clean up the directory after we've verified its creation. Note that we don't use test_when_finished here, and instead just make rmdir part of the &&-chain. We should only remove something that we're confident we just created. A failure in the middle of the chain either means there's nothing to clean up, or we are very confused and should err on the side of caution. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c578a09 commit fa3142c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t7610-mergetool.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ test_expect_success 'filenames seen by tools start with ./' '
591591

592592
test_lazy_prereq MKTEMP '
593593
tempdir=$(mktemp -d -t foo.XXXXXX) &&
594-
test -d "$tempdir"
594+
test -d "$tempdir" &&
595+
rmdir "$tempdir"
595596
'
596597

597598
test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '

0 commit comments

Comments
 (0)