Skip to content

Commit 50ff236

Browse files
mrudEric Wong
authored andcommitted
git-svn: Canonicalize svn urls to prevent libsvn assertion
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. [ew: fixed trailing whitespace] Signed-off-by: Ulrich Dangel <[email protected]> Acked-by: Eric Wong <[email protected]>
1 parent 2317d28 commit 50ff236

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

git-svn.perl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ sub cmd_init {
389389
}
390390
my $url = shift or die "SVN repository location required ",
391391
"as a command-line argument\n";
392+
$url = canonicalize_url($url);
392393
init_subdir(@_);
393394
do_git_init_db();
394395

@@ -806,6 +807,12 @@ sub canonicalize_path {
806807
return $path;
807808
}
808809

810+
sub canonicalize_url {
811+
my ($url) = @_;
812+
$url =~ s#^([^:]+://[^/]*/)(.*)$#$1 . canonicalize_path($2)#e;
813+
return $url;
814+
}
815+
809816
# get_svnprops(PATH)
810817
# ------------------
811818
# Helper for cmd_propget and cmd_proplist below.
@@ -875,7 +882,7 @@ sub cmd_multi_init {
875882

876883
$_prefix = '' unless defined $_prefix;
877884
if (defined $url) {
878-
$url =~ s#/+$##;
885+
$url = canonicalize_url($url);
879886
init_subdir(@_);
880887
}
881888
do_git_init_db();

0 commit comments

Comments
 (0)