Skip to content

Commit c5770f7

Browse files
thenigangitster
authored andcommitted
contrib/diffall: create tmp dirs without mktemp
mktemp is not available on all platforms. Instead of littering the code with a work-around, this commit replaces mktemp with a one-line Perl script. Signed-off-by: Tim Henigan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a22a947 commit c5770f7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

contrib/diffall/git-diffall

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ cd "$cdup" || {
4545
exit 1
4646
}
4747

48-
# mktemp is not available on all platforms (missing from msysgit)
49-
# Use a hard-coded tmp dir if it is not available
50-
tmp="$(mktemp -d -t tmp.XXXXXX 2>/dev/null)" || {
51-
tmp=/tmp/git-diffall-tmp.$$
52-
mkdir "$tmp" || exit 1
53-
}
54-
48+
# set up temp dir
49+
tmp=$(perl -e 'use File::Temp qw(tempdir);
50+
$t=tempdir("/tmp/git-diffall.XXXXX") or exit(1);
51+
print $t') || exit 1
5552
trap 'rm -rf "$tmp" 2>/dev/null' EXIT
5653

5754
left=

0 commit comments

Comments
 (0)