git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-svn: fix rel_path() when not connected to the repository root

From
EWEric Wong <normalperson@yhbt.net>
Date
Mar 25, 2007, 23:35 UTC
Message-ID
<20070325233531.GA13433@muzzle>
In-Reply-To
<20070325204156.GK942MdfPADPa@greensroom.kotnet.org>

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. ---

Sven: Let me know if this fixes things for your repo.
 git-svn.perl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e845789..e0a48c2 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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 {
-- 
Eric Wong
Message 1 of 1 in “git-svn: fix rel_path() when not connected to the repository root”
  1. git-svn: fix rel_path() when not connected to the repository rootEric Wong, Mar 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.