Code

git-svn: fix rel_path() when not connected to the repository root
[git.git] / git-svn.perl
index e8457893db963ad3bb6be270aba0a81481119b1c..e0a48c2a8bd59b20f56d5a0570b19e0bd5c0d438 100755 (executable)
@@ -1327,8 +1327,10 @@ sub rel_path {
        my ($self) = @_;
        my $repos_root = $self->ra->{repos_root};
        return $self->{path} if ($self->{url} eq $repos_root);
-       die "BUG: rel_path failed! repos_root: $repos_root, Ra URL: ",
-           $self->ra->{url}, " path: $self->{path},  URL: $self->{url}\n";
+       my $url = $self->{url} .
+                 (length $self->{path} ? "/$self->{path}" : $self->{path});
+       $url =~ s!^\Q$repos_root\E(?:/+|$)!!g;
+       $url;
 }
 
 sub traverse_ignore {