Merge branch 'md/gitweb-sort-by-age'
[gitweb.git] / perl / Git / SVN / Ra.pm
index c88b2b91daad10ab565745e5659c0f110da6dbec..049c97bfafac143e552f2e8ddb988292a6328df2 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;
@@ -101,6 +103,7 @@ sub new {
                        $Git::SVN::Prompt::_no_auth_cache = 1;
                }
        } # no warnings 'once'
+
        my $self = SVN::Ra->new(url => $url, auth => $baton,
                              config => $config,
                              pool => SVN::Pool->new,
@@ -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;
        }
@@ -409,7 +416,7 @@ sub gs_fetch_loop_common {
                }
                $SVN::Error::handler = $err_handler;
 
-               my %exists = map { $_->{path} => $_ } @$gsv;
+               my %exists = map { $_->path => $_ } @$gsv;
                foreach my $r (sort {$a <=> $b} keys %revs) {
                        my ($paths, $logged) = @{$revs{$r}};
 
@@ -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;