summaryrefslogtreecommitdiff
path: root/perl/Git.pm
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2014-10-29 19:31:55 +0000
committerEric Wong <normalperson@yhbt.net>2014-10-29 19:59:23 +0000
commit822aaf0f0865299d6cd3a6866e8047638e3f898c (patch)
treeb77e7ed4e40bafb78e58c684dd75bb9f512d6cf3 /perl/Git.pm
parent7676aff70973e617c3f58a8633db6d0e3ee99e45 (diff)
downloadgit-822aaf0f0865299d6cd3a6866e8047638e3f898c.tar.gz
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>
Diffstat (limited to 'perl/Git.pm')
-rw-r--r--perl/Git.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 204fdc6737..b5905ee1ad 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1294,8 +1294,11 @@ sub _temp_cache {
$tmpdir = $self->repo_path();
}
+ my $n = $name;
+ $n =~ s/\W/_/g; # no strange chars
+
($$temp_fd, $fname) = File::Temp::tempfile(
- 'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
+ "Git_${n}_XXXXXX", UNLINK => 1, DIR => $tmpdir,
) or throw Error::Simple("couldn't open new temp file");
$$temp_fd->autoflush;