git-svn dcommit fails because the repository name contains a space

筅森魡賤 提交于 2019-12-05 22:02:27

I believe the problem with spaces is fixed in Git >= 1.8.0 (See: #786942).

So you should consider to upgrade it.

See GitHub Home page: https://github.com/git/git

Karl

I was able to work around the problem of git svn not working for repositories with spaces in them by patching git-svn.

I updated the url_path function to:

sub url_path { 
  my ($self, $path) = @_; 

  my $url = $self->{url} . '/' . $self->repo_path($path); 
  if ($self->{url} =~ m#^https?://#) { 
    $url =~ s!([^~a-zA-Z0-9_./-])!uc sprintf("%%%02x",ord($1))!eg; 
    $url =~ s!^(https?)%3A//!$1://!; 
  } 
  $url 
} 

For windows (x64) users, this function can be found in Editor.pm file, which is located in

{Git installation folder}\mingw64\share\perl5\site_perl\Git\SVN\

This ensures that the spaces in the url are encoded correctly.

It seems to work for me, but hasn't been tested thoroughly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!