Skip to content

Commit b557165

Browse files
author
Eric Wong
committed
git-svn: fix URL canonicalization during init w/ SVN 1.7+
URL canonicalization when full URLs are passed became broken when using SVN::_Core::svn_dirent_canonicalize under SVN 1.7. Ensure we canonicalize paths and URLs with appropriate functions for each type from now on as the path/URL-agnostic SVN::_Core::svn_path_canonicalize function is deprecated in SVN. Tested with the following commands: git svn init -T svn://svn.code.sf.net/p/squirrelmail/code/trunk git svn init -b svn://svn.code.sf.net/p/squirrelmail/code/branches Reported-by: Adam Dinwoodie <[email protected]> http://mid.gmane.org/[email protected] Signed-off-by: Eric Wong <[email protected]>
1 parent 4be4d55 commit b557165

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

git-svn.perl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,11 +1745,12 @@ sub post_fetch_checkout {
17451745

17461746
sub complete_svn_url {
17471747
my ($url, $path) = @_;
1748-
$path = canonicalize_path($path);
17491748

1750-
# If the path is not a URL...
1751-
if ($path !~ m#^[a-z\+]+://#) {
1752-
if (!defined $url || $url !~ m#^[a-z\+]+://#) {
1749+
if ($path =~ m#^[a-z\+]+://#i) { # path is a URL
1750+
$path = canonicalize_url($path);
1751+
} else {
1752+
$path = canonicalize_path($path);
1753+
if (!defined $url || $url !~ m#^[a-z\+]+://#i) {
17531754
fatal("E: '$path' is not a complete URL ",
17541755
"and a separate URL is not specified");
17551756
}
@@ -1764,11 +1765,12 @@ sub complete_url_ls_init {
17641765
print STDERR "W: $switch not specified\n";
17651766
return;
17661767
}
1767-
$repo_path = canonicalize_path($repo_path);
1768-
if ($repo_path =~ m#^[a-z\+]+://#) {
1768+
if ($repo_path =~ m#^[a-z\+]+://#i) {
1769+
$repo_path = canonicalize_url($repo_path);
17691770
$ra = Git::SVN::Ra->new($repo_path);
17701771
$repo_path = '';
17711772
} else {
1773+
$repo_path = canonicalize_path($repo_path);
17721774
$repo_path =~ s#^/+##;
17731775
unless ($ra) {
17741776
fatal("E: '$repo_path' is not a complete URL ",

t/t9117-git-svn-init-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
119119
rm -f warning
120120
'
121121

122-
test_expect_failure 'init with -T as a full url works' '
122+
test_expect_success 'init with -T as a full url works' '
123123
test ! -d project &&
124124
git svn init -T "$svnrepo"/project/trunk project &&
125125
rm -rf project

0 commit comments

Comments
 (0)