Skip to content

Commit e1ca0de

Browse files
committed
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
2 parents a0d3ab9 + 1b3069a commit e1ca0de

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

git-svn.perl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,11 +3332,11 @@ sub change_file_prop {
33323332

33333333
sub apply_textdelta {
33343334
my ($self, $fb, $exp) = @_;
3335-
my $fh = Git::temp_acquire('svn_delta');
3335+
my $fh = $::_repository->temp_acquire('svn_delta');
33363336
# $fh gets auto-closed() by SVN::TxDelta::apply(),
33373337
# (but $base does not,) so dup() it for reading in close_file
33383338
open my $dup, '<&', $fh or croak $!;
3339-
my $base = Git::temp_acquire('git_blob');
3339+
my $base = $::_repository->temp_acquire('git_blob');
33403340
if ($fb->{blob}) {
33413341
print $base 'link ' if ($fb->{mode_a} == 120000);
33423342
my $size = $::_repository->cat_blob($fb->{blob}, $base);
@@ -3377,7 +3377,8 @@ sub close_file {
33773377
warn "$path has mode 120000",
33783378
" but is not a link\n";
33793379
} else {
3380-
my $tmp_fh = Git::temp_acquire('svn_hash');
3380+
my $tmp_fh = $::_repository->temp_acquire(
3381+
'svn_hash');
33813382
my $res;
33823383
while ($res = sysread($fh, my $str, 1024)) {
33833384
my $out = syswrite($tmp_fh, $str, $res);
@@ -3765,7 +3766,7 @@ sub change_file_prop {
37653766

37663767
sub _chg_file_get_blob ($$$$) {
37673768
my ($self, $fbat, $m, $which) = @_;
3768-
my $fh = Git::temp_acquire("git_blob_$which");
3769+
my $fh = $::_repository->temp_acquire("git_blob_$which");
37693770
if ($m->{"mode_$which"} =~ /^120/) {
37703771
print $fh 'link ' or croak $!;
37713772
$self->change_file_prop($fbat,'svn:special','*');

perl/Git.pm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,7 @@ issue.
961961
=cut
962962

963963
sub temp_acquire {
964-
my ($self, $name) = _maybe_self(@_);
965-
966-
my $temp_fd = _temp_cache($name);
964+
my $temp_fd = _temp_cache(@_);
967965

968966
$TEMP_FILES{$temp_fd}{locked} = 1;
969967
$temp_fd;
@@ -1005,7 +1003,7 @@ sub temp_release {
10051003
}
10061004

10071005
sub _temp_cache {
1008-
my ($name) = @_;
1006+
my ($self, $name) = _maybe_self(@_);
10091007

10101008
_verify_require();
10111009

@@ -1022,9 +1020,16 @@ sub _temp_cache {
10221020
"' was closed. Opening replacement.";
10231021
}
10241022
my $fname;
1023+
1024+
my $tmpdir;
1025+
if (defined $self) {
1026+
$tmpdir = $self->repo_path();
1027+
}
1028+
10251029
($$temp_fd, $fname) = File::Temp->tempfile(
1026-
'Git_XXXXXX', UNLINK => 1
1030+
'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
10271031
) or throw Error::Simple("couldn't open new temp file");
1032+
10281033
$$temp_fd->autoflush;
10291034
binmode $$temp_fd;
10301035
$TEMP_FILES{$$temp_fd}{fname} = $fname;

0 commit comments

Comments
 (0)