aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-14 09:21:08 -0800
committerJunio C Hamano <gitster@pobox.com>2008-11-14 09:21:08 -0800
commite1ca0defd2039aecd7b5a68ed653f8ec40cf509e (patch)
tree41b26b6a2c10340fa4f37b047acd993852ffd179
parenta0d3ab9c277f1a198ec8e29432c0127d4cf719d2 (diff)
parent1b3069a753e2a2a3794db9235ea79747833cad65 (diff)
downloadgit-e1ca0defd2039aecd7b5a68ed653f8ec40cf509e.tar.gz
git-e1ca0defd2039aecd7b5a68ed653f8ec40cf509e.tar.xz
Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn: git-svn: Update git-svn to use the ability to place temporary files within repository directory Git.pm: Make _temp_cache use the repository directory git-svn: proper detection of bare repositories git-svn: respect i18n.commitencoding config git-svn: don't escape tilde ('~') for http(s) URLs
-rwxr-xr-xgit-svn.perl9
-rw-r--r--perl/Git.pm15
2 files changed, 15 insertions, 9 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 86075ec61..914c707a9 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3332,11 +3332,11 @@ sub change_file_prop {
sub apply_textdelta {
my ($self, $fb, $exp) = @_;
- my $fh = Git::temp_acquire('svn_delta');
+ my $fh = $::_repository->temp_acquire('svn_delta');
# $fh gets auto-closed() by SVN::TxDelta::apply(),
# (but $base does not,) so dup() it for reading in close_file
open my $dup, '<&', $fh or croak $!;
- my $base = Git::temp_acquire('git_blob');
+ my $base = $::_repository->temp_acquire('git_blob');
if ($fb->{blob}) {
print $base 'link ' if ($fb->{mode_a} == 120000);
my $size = $::_repository->cat_blob($fb->{blob}, $base);
@@ -3377,7 +3377,8 @@ sub close_file {
warn "$path has mode 120000",
" but is not a link\n";
} else {
- my $tmp_fh = Git::temp_acquire('svn_hash');
+ my $tmp_fh = $::_repository->temp_acquire(
+ 'svn_hash');
my $res;
while ($res = sysread($fh, my $str, 1024)) {
my $out = syswrite($tmp_fh, $str, $res);
@@ -3765,7 +3766,7 @@ sub change_file_prop {
sub _chg_file_get_blob ($$$$) {
my ($self, $fbat, $m, $which) = @_;
- my $fh = Git::temp_acquire("git_blob_$which");
+ my $fh = $::_repository->temp_acquire("git_blob_$which");
if ($m->{"mode_$which"} =~ /^120/) {
print $fh 'link ' or croak $!;
$self->change_file_prop($fbat,'svn:special','*');
diff --git a/perl/Git.pm b/perl/Git.pm
index ba9445378..dde9105df 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -961,9 +961,7 @@ issue.
=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;
@@ -1005,7 +1003,7 @@ sub temp_release {
}
sub _temp_cache {
- my ($name) = @_;
+ my ($self, $name) = _maybe_self(@_);
_verify_require();
@@ -1022,9 +1020,16 @@ sub _temp_cache {
"' 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;