threads / patch / 19944

patchCanonicalize svn urls to prevent libsvn assertion

Subject: [PATCH] Canonicalize svn urls to prevent libsvn assertion

## tl;dr

2 messages between Jun 26, 2009 and Jun 26, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ulrich Dangel· Jun 26, 2009, 14:52 UTC · lore

Cloning/initializing svn repositories with an uncanonicalize url does not work as libsvn throws an assertion. This patch canonicalize svn uris for the clone and init command from git-svn.

Signed-off-by: Ulrich Dangel <uli@spamt.net>
---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Show changes to git-svn.perl +8 −1
diff --git a/git-svn.perl b/git-svn.perl
index 3301797..5130a8c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -380,6 +380,7 @@ sub cmd_init {
 	}
 	my $url = shift or die "SVN repository location required ",
 	                       "as a command-line argument\n";
+	$url = canonicalize_url($url);
 	init_subdir(@_);
 	do_git_init_db();
 
@@ -741,6 +742,12 @@ sub canonicalize_path {
 	return $path;
 }
 
+sub canonicalize_url {
+	my ($url) = @_;
+	$url =~ s#^([^:]+://[^/]*/)(.*)$#$1 . canonicalize_path($2)#e;
+	return $url;
+}
+
 # get_svnprops(PATH)
 # ------------------
 # Helper for cmd_propget and cmd_proplist below.
@@ -810,7 +817,7 @@ sub cmd_multi_init {
 
 	$_prefix = '' unless defined $_prefix;
 	if (defined $url) {
-		$url =~ s#/+$##;
+		$url = canonicalize_url($url);    
 		init_subdir(@_);
 	}
 	do_git_init_db();
-- 
1.6.3.1
Eric Wong· Jun 26, 2009, 21:49 UTC · re: Ulrich Dangel · lore

Re: [PATCH] Canonicalize svn urls to prevent libsvn assertion

Ulrich Dangel <uli@spamt.net> wrote:
Show 5 quoted lines
> Cloning/initializing svn repositories with an uncanonicalize url does not
> work as libsvn throws an assertion. This patch canonicalize svn uris for the
> clone and init command from git-svn.
> 
> Signed-off-by: Ulrich Dangel <uli@spamt.net>
Thanks,

I'm not getting any assertions in my version of SVN (1.5.1) but it actually does cause issues with path stripping when following repositories.

Acked-by: Eric Wong <normalperson@yhbt.net>
..and pushed out to git://git.bogomips.org/git-svn
There was a minor trailing whitespace issue which I fixed, too
-- 
Eric Wong

← back to recent threads