Skip to content

Commit

Permalink
git-svn: Canonicalize svn urls to prevent libsvn assertion
Browse files Browse the repository at this point in the history
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 <uli@spamt.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Ulrich Dangel authored and Eric Wong committed Jun 26, 2009
1 parent 2317d28 commit 50ff236
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,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();

Expand Down Expand Up @@ -806,6 +807,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.
Expand Down Expand Up @@ -875,7 +882,7 @@ sub cmd_multi_init {

$_prefix = '' unless defined $_prefix;
if (defined $url) {
$url =~ s#/+$##;
$url = canonicalize_url($url);
init_subdir(@_);
}
do_git_init_db();
Expand Down

0 comments on commit 50ff236

Please sign in to comment.