Git.pm: add specified name to tempfile template

This should help me track down errors in git-svn more easily: write .git/Git_XXXXXX: Bad file descriptor at /usr/lib/perl5/SVN/Ra.pm line 623 Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Oct 29, 2014 at 19:31 UTC 822aaf0f0865299d6cd3a6866e8047638e3f898c
1 file changed +4 -1
perl/Git.pm
+4 -1
@@ -1294,8 +1294,11 @@ sub _temp_cache {
1294 $tmpdir = $self->repo_path();
1295 }
1296
1297 + my $n = $name;
1298 + $n =~ s/\W/_/g; # no strange chars
1299 +
1300 ($$temp_fd, $fname) = File::Temp::tempfile(
1298 - 'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
1301 + "Git_${n}_XXXXXX", UNLINK => 1, DIR => $tmpdir,
1302 ) or throw Error::Simple("couldn't open new temp file");
1303
1304 $$temp_fd->autoflush;