git-svn: fix rel_path() when not connected to the repository root
This should fix fetching for people who did not use "git svn --minimize" or cannot connect to the repository root due to the lack of permissions. I'm not sure what I was on when I made the change to the rel_path() function in 4e9f6cc78e5d955bd0faffe76ae9aea6590189f1 that made it die() when we weren't connected to the repository root :x Thanks to Sven Verdoolaege for reporting this bug. Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Mar 25, 2007 at 16:35 UTC
0b59451c1be6be3d0df80be9dc8aeedb355ca44b
1 file changed
+4
-2
git-svn.perl
+4
-2
@@ -1327,8 +1327,10 @@ sub rel_path {
1327
my ($self) = @_;
1328
my $repos_root = $self->ra->{repos_root};
1329
return $self->{path} if ($self->{url} eq $repos_root);
1330
- die "BUG: rel_path failed! repos_root: $repos_root, Ra URL: ",
1331
- $self->ra->{url}, " path: $self->{path}, URL: $self->{url}\n";
1330
+ my $url = $self->{url} .
1331
+ (length $self->{path} ? "/$self->{path}" : $self->{path});
1332
+ $url =~ s!^\Q$repos_root\E(?:/+|$)!!g;
1333
+ $url;
1334
}
1335
1336
sub traverse_ignore {