From: "Jerry Seutter" <jseutter@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] "git svn clone" fails when tags have illegal url characters in them.
Date: Fri, 12 Dec 2008 15:46:38 -0700 [thread overview]
Message-ID: <2c8d48d70812121446m7539a054p86588488d77302f4@mail.gmail.com> (raw)
Found a repository with a tag that had a hash (#) mark in the tag name.
The svn repository was available via WebDAV. "git svn clone <url>" would
generate an invalid url when trying to fetch the tag, causing a server
400 result on the other end of the connection.
The fix is to escape the url correctly. This is a quick and dirty
hack that copies two functions from earlier in the file - only the last
line modified in the commit is important.
Signed-off-by: Jerry Seutter <jseutter@gmail.com>
---
git-svn.perl | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 2c206e9..6b9e010 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2213,9 +2213,28 @@ sub metadata_url {
(length $self->{path} ? '/' . $self->{path} : '');
}
+sub junk_escape_uri_only {
+ my ($uri) = @_;
+ my @tmp;
+ foreach (split m{/}, $uri) {
+ s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
+ push @tmp, $_;
+ }
+ join('/', @tmp);
+}
+
+sub junk_escape_url {
+ my ($url) = @_;
+ if ($url =~ m#^([^:]+)://([^/]*)(.*)$#) {
+ my ($scheme, $domain, $uri) = ($1, $2, junk_escape_uri_only($3));
+ $url = "$scheme://$domain$uri";
+ }
+ $url;
+}
+
sub full_url {
my ($self) = @_;
- $self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
+ junk_escape_url($self->{url} . (length $self->{path} ? '/' .
$self->{path} : ''));
}
--
1.6.1.rc2.20.gde0d.dirty
reply other threads:[~2008-12-12 22:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c8d48d70812121446m7539a054p86588488d77302f4@mail.gmail.com \
--to=jseutter@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).