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 <tim.henigan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tim Henigan committed
Mar 14, 2012 at 12:38 UTC
c5770f79068fb1317c1fd19da7e7bfcc075132f3
1 file changed
+4
-7
contrib/diffall/git-diffall
+4
-7
@@ -45,13 +45,10 @@ cd "$cdup" || {
45
exit 1
46
}
47
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
52
trap 'rm -rf "$tmp" 2>/dev/null' EXIT
53
54
left=