summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe4003f)
raw | patch | inline | side by side (parent: fe4003f)
author | Marten Svanfeldt (dev) <developer@svanfeldt.com> | |
Thu, 13 Nov 2008 12:04:09 +0000 (20:04 +0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 14 Nov 2008 06:36:34 +0000 (22:36 -0800) |
Update the usage of File::Temp->tempfile to place the temporary files
within the repository directory instead of just letting Perl decide what
directory to use, given there is a repository specified when requesting
the temporary file.
This is needed to be able to fix git-svn on msys as msysperl generates
paths with UNIX-style paths (/tmp/xxx) while the git tools expect natvie
path format (c:/..). The repository dir is stored in native format so by
using it as the base directory for temporary files we always get a
usable native full path.
Signed-off-by: Marten Svanfeldt <developer@svanfeldt.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
within the repository directory instead of just letting Perl decide what
directory to use, given there is a repository specified when requesting
the temporary file.
This is needed to be able to fix git-svn on msys as msysperl generates
paths with UNIX-style paths (/tmp/xxx) while the git tools expect natvie
path format (c:/..). The repository dir is stored in native format so by
using it as the base directory for temporary files we always get a
usable native full path.
Signed-off-by: Marten Svanfeldt <developer@svanfeldt.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
perl/Git.pm | patch | blob | history |
diff --git a/perl/Git.pm b/perl/Git.pm
index ba94453781c98a97a95c65999873fc28b013340d..dde9105df8464911451830321e4da1cbae924955 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
=cut
sub temp_acquire {
- my ($self, $name) = _maybe_self(@_);
-
- my $temp_fd = _temp_cache($name);
+ my $temp_fd = _temp_cache(@_);
$TEMP_FILES{$temp_fd}{locked} = 1;
$temp_fd;
}
sub _temp_cache {
- my ($name) = @_;
+ my ($self, $name) = _maybe_self(@_);
_verify_require();
"' was closed. Opening replacement.";
}
my $fname;
+
+ my $tmpdir;
+ if (defined $self) {
+ $tmpdir = $self->repo_path();
+ }
+
($$temp_fd, $fname) = File::Temp->tempfile(
- 'Git_XXXXXX', UNLINK => 1
+ 'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
) or throw Error::Simple("couldn't open new temp file");
+
$$temp_fd->autoflush;
binmode $$temp_fd;
$TEMP_FILES{$$temp_fd}{fname} = $fname;