Skip to content

Commit 6a004d3

Browse files
author
Eric Wong
committed
git-svn: don't escape tilde ('~') for http(s) URLs
Thanks to Jose Carlos Garcia Sogo and Björn Steinbrink for the bug report. On 2008.10.18 23:39:19 +0200, Björn Steinbrink wrote: > Hi, > > Jose Carlos Garcia Sogo reported on #git that a git-svn clone of this > svn repo fails for him: > https://sucs.org/~welshbyte/svn/backuptool/trunk > > I can reproduce that here with: > git-svn version 1.6.0.2.541.g46dc1.dirty (svn 1.5.1) > > The error message I get is: > Apache got a malformed URI: Unusable URI: it does not refer to this > repository at /usr/local/libexec/git-core/git-svn line 4057 > > strace revealed that git-svn url-encodes ~ while svn does not do that. > > For svn we have: > write(5, "<S:update-report send-all=\"true\" xmlns:S=\"svn:\"> > <S:src-path>https://sucs.org/~welshbyte/svn/backuptool/trunk</S:src-path>... > > While git-svn shows: > write(7, "<S:update-report send-all=\"true\" xmlns:S=\"svn:\"> > <S:src-path>https://sucs.org/%7Ewelshbyte/svn/backuptool/trunk</S:src-path>... Signed-off-by: Eric Wong <[email protected]>
1 parent 171d766 commit 6a004d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-svn.perl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ sub escape_uri_only {
852852
my ($uri) = @_;
853853
my @tmp;
854854
foreach (split m{/}, $uri) {
855-
s/([^\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
855+
s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
856856
push @tmp, $_;
857857
}
858858
join('/', @tmp);
@@ -3537,7 +3537,7 @@ sub repo_path {
35373537
sub url_path {
35383538
my ($self, $path) = @_;
35393539
if ($self->{url} =~ m#^https?://#) {
3540-
$path =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
3540+
$path =~ s/([^~a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
35413541
}
35423542
$self->{url} . '/' . $self->repo_path($path);
35433543
}
@@ -3890,7 +3890,7 @@ sub escape_uri_only {
38903890
my ($uri) = @_;
38913891
my @tmp;
38923892
foreach (split m{/}, $uri) {
3893-
s/([^\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
3893+
s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
38943894
push @tmp, $_;
38953895
}
38963896
join('/', @tmp);

0 commit comments

Comments
 (0)