зеркало из https://github.com/microsoft/git.git
Git.pm: Make _temp_cache use the repository directory
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>
This commit is contained in:
Родитель
fe4003f630
Коммит
bcdd1b4456
15
perl/Git.pm
15
perl/Git.pm
|
@ -961,9 +961,7 @@ issue.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub temp_acquire {
|
sub temp_acquire {
|
||||||
my ($self, $name) = _maybe_self(@_);
|
my $temp_fd = _temp_cache(@_);
|
||||||
|
|
||||||
my $temp_fd = _temp_cache($name);
|
|
||||||
|
|
||||||
$TEMP_FILES{$temp_fd}{locked} = 1;
|
$TEMP_FILES{$temp_fd}{locked} = 1;
|
||||||
$temp_fd;
|
$temp_fd;
|
||||||
|
@ -1005,7 +1003,7 @@ sub temp_release {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _temp_cache {
|
sub _temp_cache {
|
||||||
my ($name) = @_;
|
my ($self, $name) = _maybe_self(@_);
|
||||||
|
|
||||||
_verify_require();
|
_verify_require();
|
||||||
|
|
||||||
|
@ -1022,9 +1020,16 @@ sub _temp_cache {
|
||||||
"' was closed. Opening replacement.";
|
"' was closed. Opening replacement.";
|
||||||
}
|
}
|
||||||
my $fname;
|
my $fname;
|
||||||
|
|
||||||
|
my $tmpdir;
|
||||||
|
if (defined $self) {
|
||||||
|
$tmpdir = $self->repo_path();
|
||||||
|
}
|
||||||
|
|
||||||
($$temp_fd, $fname) = File::Temp->tempfile(
|
($$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");
|
) or throw Error::Simple("couldn't open new temp file");
|
||||||
|
|
||||||
$$temp_fd->autoflush;
|
$$temp_fd->autoflush;
|
||||||
binmode $$temp_fd;
|
binmode $$temp_fd;
|
||||||
$TEMP_FILES{$$temp_fd}{fname} = $fname;
|
$TEMP_FILES{$$temp_fd}{fname} = $fname;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче