Skip to content

Commit

Permalink
git-svn: reuse open SVN::Ra connections by URL
Browse files Browse the repository at this point in the history
Note: this can cause problems with Perl's reference counting GC,
so I'm disabling Git::SVN::Ra::DESTROY.  If we notice more
problems down the line, we can disable this enhancement.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Eric Wong committed Feb 23, 2007
1 parent 780a2f5 commit f6f0987
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,7 @@ package Git::SVN::Ra;
use strict;
use warnings;
my ($can_do_switch);
my %RA;

BEGIN {
# enforce temporary pool usage for some simple functions
Expand All @@ -2033,6 +2034,9 @@ BEGIN

sub new {
my ($class, $url) = @_;
$url =~ s!/+$!!;
return $RA{$url} if $RA{$url};

SVN::_Core::svn_config_ensure($config_dir, undef);
my ($baton, $callbacks) = SVN::Core::auth_open_helper([
SVN::Client::get_simple_provider(),
Expand All @@ -2057,13 +2061,11 @@ sub new {
$self->{svn_path} = $url;
$self->{repos_root} = $self->get_repos_root;
$self->{svn_path} =~ s#^\Q$self->{repos_root}\E/*##;
bless $self, $class;
$RA{$url} = bless $self, $class;
}

sub DESTROY {
my $self = shift;
$self->{pool}->clear if $self->{pool};
$self->SUPER::DESTROY(@_);
# do not call the real DESTROY since we store ourselves in %RA
}

sub dup {
Expand Down

0 comments on commit f6f0987

Please sign in to comment.