[PATCH] Canonicalize svn urls to prevent libsvn assertion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]