Re: [PATCH] Re: git-svn fetch doesn't like spaces in branch names
- From
Benoit Sigoure <tsuna@lrde.epita.fr>
- Date
- Nov 8, 2007, 08:49 UTC
- Message-ID
- <06671B5D-DF06-448E-A3BD-D936C1DE6BAA@lrde.epita.fr>
- In-Reply-To
- <20071108072918.GC3170@steel.home>
On Nov 8, 2007, at 8:29 AM, Alex Riesen wrote:
Show 29 quoted lines
> Michael J. Cohen, Thu, Nov 08, 2007 01:53:07 +0100:
>>> mini:TextMateBundles mjc$ git-svn fetch
>>> Found possible branch point:
>>> http://macromates.com/svn/Bundles/trunk/Tools/Dialog PlugIn =>
>>> http://macromates.com/svn/Bundles/branches/Dialog PlugIn
>>> Completion Menu,
>>> 8089
>>> Initializing parent: Dialog PlugIn Completion Menu@8089
>>> Bad URL passed to RA layer: Malformed URL for repository at
>>> /opt/local/bin/git-svn line 1607
>>>
>>> looks like that might need to be %20 ?
>>
>>
>> Hacky, but it works.
>>
>> Signed-off-by: Michael J. Cohen <mjc@cruiseplanners.com>
>>
>> diff --git a/git-svn.perl b/git-svn.perl
>> index dd93e32..5dc3b9c 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
>> @@ -1976,6 +1976,7 @@ sub find_parent_branch {
>> my $r = $i->{copyfrom_rev};
>> my $repos_root = $self->ra->{repos_root};
>> my $url = $self->ra->{url};
>> + $branch_from =~ s@([\s])@sprintf("%%%02X", ord($1))@seg;
>
> You don't need "[" and "]".You don't even need the "(" and ")"$branch_from =~ s@\s@sprintf("%%%02X", ord($&))@seg;But I think it'd be better to fix this properly. I guess some people use branch names with accentuated characters such as é è ü whatever. What about this instead (untested):
$branch_from =~ s@[^\w\d_]@sprintf("%%%02X", ord($&))@seg;Otherwise there are various existing Perl modules such as http:// search.cpan.org/dist/URI/URI/Escape.pm but this seems overkill / not portable (unless we distribute these files along with Git).
Cheers,
-- Benoit Sigoure aka Tsuna EPITA Research and Development Laboratory