git-svn: introduce add_path_to_url function

Remove the ad-hoc versions.

This is mostly to normalize the process and ensure the URLs produced
don't have double slashes or anything.

Also provides a place to fix the corner case where a file path
contains a percent sign.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Michael G. Schwern
2012-07-28 02:47:50 -07:00
committed by Eric Wong
parent 8266fc8be1
commit d2fd119c4f
5 changed files with 75 additions and 23 deletions

View File

@ -35,6 +35,7 @@ use Git::SVN::Utils qw(
canonicalize_path
canonicalize_url
join_paths
add_path_to_url
);
use Git qw(
@ -1436,7 +1437,7 @@ sub cmd_info {
# canonicalize_path() will return "" to make libsvn 1.5.x happy,
$path = "." if $path eq "";
my $full_url = canonicalize_url( $url . ($fullpath eq "" ? "" : "/$fullpath") );
my $full_url = canonicalize_url( add_path_to_url( $url, $fullpath ) );
if ($_url) {
print "$full_url\n";