Merge branch 'rr/test-use-shell-path-not-shell'
[gitweb.git] / perl / Git / SVN / Ra.pm
index 268b368de34a3056e7da57fcf29128c170c62063..90ec30bfff25c5cb5cd3c171fdc4a81c46e0f156 100644 (file)
@@ -5,6 +5,8 @@ package Git::SVN::Ra;
 use SVN::Client;
 use Git::SVN::Utils qw(
        canonicalize_url
+       canonicalize_path
+       add_path_to_url
 );
 
 use SVN::Ra;
@@ -69,7 +71,7 @@ ()
 
 sub new {
        my ($class, $url) = @_;
-       $url =~ s!/+$!!;
+       $url = canonicalize_url($url);
        return $RA if ($RA && $RA->url eq $url);
 
        ::_req_svn();
@@ -101,7 +103,8 @@ sub new {
                        $Git::SVN::Prompt::_no_auth_cache = 1;
                }
        } # no warnings 'once'
-       my $self = SVN::Ra->new(url => canonicalize_url($url), auth => $baton,
+
+       my $self = SVN::Ra->new(url => $url, auth => $baton,
                              config => $config,
                              pool => SVN::Pool->new,
                              auth_provider_callbacks => $callbacks);
@@ -197,6 +200,7 @@ sub get_log {
                                qw/copyfrom_path copyfrom_rev action/;
                        if ($s{'copyfrom_path'}) {
                                $s{'copyfrom_path'} =~ s/$prefix_regex//;
+                               $s{'copyfrom_path'} = canonicalize_path($s{'copyfrom_path'});
                        }
                        $_[0]{$p} = \%s;
                }
@@ -287,9 +291,8 @@ sub gs_do_switch {
        my $path = $gs->path;
        my $pool = SVN::Pool->new;
 
-       my $full_url = $self->url;
-       my $old_url = $full_url;
-       $full_url .= '/' . $path if length $path;
+       my $old_url = $self->url;
+       my $full_url = add_path_to_url( $self->url, $path );
        my ($ra, $reparented);
 
        if ($old_url =~ m#^svn(\+ssh)?://# ||
@@ -301,7 +304,11 @@ sub gs_do_switch {
                $ra = Git::SVN::Ra->new($full_url);
                $ra_invalid = 1;
        } elsif ($old_url ne $full_url) {
-               SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);
+               SVN::_Ra::svn_ra_reparent(
+                       $self->{session},
+                       canonicalize_url($full_url),
+                       $pool
+               );
                $self->url($full_url);
                $reparented = 1;
        }
@@ -555,7 +562,7 @@ sub minimize_url {
        my @components = split(m!/!, $self->{svn_path});
        my $c = '';
        do {
-               $url .= "/$c" if length $c;
+               $url = add_path_to_url($url, $c);
                eval {
                        my $ra = (ref $self)->new($url);
                        my $latest = $ra->get_latest_revnum;